summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/practicalreports/practicalreports.sty
blob: e46dfb4ef7f4e61ca22e15e470f6bd6b89262b6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
%%Author: Justin Cawood
%%License: LPPL 1.3c

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{practicalreports}[071/10/2019  v2.0.3 Practical Report Package]
\RequirePackage{mathtools, array, longtable, scrextend, float, fancyhdr, lastpage, tikzducks, pdfpages, pgffor}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\shift}[2]{
\begin{addmargin}[#1cm]{0cm}
\begin{minipage}{\textwidth}
#2
\end{minipage}
\end{addmargin}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Create a new title page
%\newtitlepage{Title}{Author}{Date}
\newcommand*{\newtitlepage}[3]{
\begin{titlepage}
    \vspace*{\fill}
    \begin{center}
      {\Huge #1}\\[0.5cm]
      {\Large #2}\\[0.4cm]
      {\small #3}
    \end{center}
    \vspace*{\fill}
 	\end{titlepage}
}

%Add a new figure
\newcommand*{\newfigure}[4]{
\begin{figure}[H]
    \centering \textbf{#1} \par\medskip
    \center{\includegraphics[width=\textwidth]
    {#3}}
	\caption{#2}
	\label{fig:#4}
\end{figure}
}

%Add a new scalable figure
\newcommand*{\newsfigure}[5]{
\begin{figure}[H]
    \centering \textbf{#1} \par\medskip
    \center{\includegraphics[scale=#5]
    {#3}}
	\caption{#2}
	\label{fig:#4}
\end{figure}
}

%Reference a labeled figure
\newcommand*{\reffigure}[1]{Figure~\ref{fig:#1}}

%Create a table
%\newtable{Caption}
%{Columns and Alignment}
%{Column Headings}
%{Table Data}
\newcommand*{\newtable}[5]{
\begin{table}[H]
\begin{center}
\caption{#1}
\vspace*{5mm}
\begin{tabular}{#2}
\hline
#3\\
\hline
#4\\
\hline
\end{tabular}
\label{table:#5}
\end{center}
\end{table}
}

%Create a long table
%\newlongtable{Caption}
%{Columns and Alignment}
%{Column Headings}
%{Table Data}
\newcommand{\newlongtable}[5]{
\begin{center}
\begin{longtable}{#2}
\label{table:#5} \\
\caption{#1} \\
\hline
#3 \\
\hline
\endfirsthead
\caption{\textit{Continued}} \\
\hline
#3 \\
\hline
\endhead
\hline\\
\endfoot
\hline
\endlastfoot
#4
\end{longtable}
\end{center}
}

%Reference a labeled table
\newcommand*{\reftable}[1]{Table~\ref{table:#1}}

%Box and solotion or multiple lines of solutions
\newcommand*{\boxanswer}[1]{
\begin{equation*}
   \addtolength{\fboxsep}{5pt}
    \boxed{
    \begin{gathered}
       #1
    \end{gathered}
    }
\end{equation*}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%Multipleys a number by 10^{user input}
\newcommand*{\E}[1]{$\times10^{#1}$}

%Multipleys a number by 10^{user input}
\newcommand*{\e}[1]{\times10^{#1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\setpagefancy}{
\pagestyle{fancy}
\fancyhf{}
}

%Add a header to all pages
\newcommand*{\header}[3]{
\lhead{#1}
\chead{#2}
\rhead{#3}
}

%Add a footer to all pages
\newcommand*{\footer}[3]{
\lfoot{#1}
\cfoot{#2}
\rfoot{#3}
}

%Add a footer to all pages
\newcommand*{\goodfoot}{
\cfoot{Page \thepage \ of \pageref{LastPage}}

\newcommand{\duckfoot}{
\cfoot{
\begin{tikzpicture}[scale=0.6]
\duck[lightsaber=red,cape=black!85!white,
body=black!70!white,darthvader=black!85!white, speech={Page},bubblecolour=cyan!20!white,laughing]
\end{tikzpicture}
\begin{tikzpicture}[scale=0.6]
\duck[parting=brown!70!black, squareglasses,
tshirt=teal!50!white, jacket=white,
buttons=gray!50!white, stethoscope, signpost={\thepage}]
\end{tikzpicture}
\begin{tikzpicture}[scale=0.6]
\colorlet{skin}{white!45!gray!80!green}
\duck[lightsaber=green, body=skin, bill=gray!80!green,
tshirt=brown!50!black, jacket=brown!30!gray, speech={of},bubblecolour=cyan!20!white,laughing]
\fill[skin,rounded corners=3] (0.44,1.70) -- (0.25,2)
-- (0.6,1.95);
\fill[skin,rounded corners=3] (1.34,1.60) --
(1.53,1.9) -- (1.16,1.85);
\end{tikzpicture}
\begin{tikzpicture}[scale=0.6]
\begin{scope}[yshift=-6]
\clip[rotate=-5] (0.68,2.38) ellipse (0.3 and 0.4);
\fill[brown,rotate=-5](0.28,2.26)ellipse (0.3 and 0.4);
\end{scope}
\duck[body=brown,mohican=brown!50!black,horsetail, signpost={\pageref{LastPage}}]
\begin{scope}[yshift=-5,xshift=1]
\clip[rotate=-5] (0.68,2.38) ellipse (0.3 and 0.4);
\fill[brown,rotate=-5](1.06,2.2) ellipse (0.3 and 0.4);
\end{scope}
\end{tikzpicture}
}
}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Make sure yor filenames are all one word, this can include underscores and each report is separated by a comma. 
\newcommand{\joinpdfs}[1]{
\foreach \report in {#1} {
\includepdfmerge{\report, -}
}
}