Skip to content

Commit 3b28945

Browse files
committed
Merging work.
2 parents fce8bc4 + 529f407 commit 3b28945

6 files changed

+16
-24
lines changed

html-settings.tex

+6-8
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,34 @@
2727
\newcommand{\htmltag}[1]{\texttt{{\textless}{#1}{\textgreater}}}
2828

2929
% Chapters, sections, and appendices with labels.
30-
\newcommand{\chaplbl}[2]{\chapter{#1}\label{#2}}
31-
\newcommand{\seclbl}[2]{\section{#1}\label{#2}}
3230
\newcommand{\appref}[1]{Appendix~\ref{#1}}
3331
\newcommand{\chapref}[1]{Chapter~\ref{#1}}
3432
\newcommand{\figref}[1]{Figure~\ref{#1}}
3533
\newcommand{\secref}[1]{Section~\ref{#1}}
3634
\newcommand{\tblref}[1]{Table~\ref{#1}}
3735

36+
% Always put \label after \caption.
37+
\newcommand{\caplbl}[2]{\caption{{#1}\label{#2}}}
38+
3839
% Image figures.
3940
\newcommand{\figimg}[3]{\begin{figure}%
4041
\centering%
4142
\includegraphics[width=\textwidth]{#1}%
42-
\caption{#2}%
43-
\label{#3}%
43+
\caplbl{#2}{#3}%
4444
\end{figure}}
4545

4646
% PDF figures.
4747
\newcommand{\figpdf}[3]{\begin{figure}%
4848
\centering%
4949
\includegraphics[scale=0.6]{#1}%
50-
\caption{#2}%
51-
\label{#3}%
50+
\caplbl{#2}{#3}%
5251
\end{figure}}
5352

5453
% PDF figures forcing location.
5554
\newcommand{\figpdfhere}[3]{\begin{figure}[H]%
5655
\centering%
5756
\includegraphics[scale=0.6]{#1}%
58-
\caption{#2}%
59-
\label{#3}%
57+
\caplbl{#2}{#3}%
6058
\end{figure}}
6159

6260
% Exercise headings.

htmlcss.tex

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ \section{Text}\label{s:htmlcss-text}
5151
Copyright & \texttt{\©} & © \\
5252
Plus/minus & \texttt{\±} & ± \\
5353
Micro & \texttt{\µ} & µ \\
54-
\caption{HTML Escapes}
55-
\label{t:htmlcss-escapes}
54+
\caplbl{HTML Escapes}{t:htmlcss-escapes}
5655
\end{longtable}
5756

5857
The first two are self-explanatory,

legacy.tex

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ \section{Equality}\label{s:legacy-equality}
1919
empty array plus empty object & \texttt{[]\ +\ \{\}} & \texttt{\{\}} (empty object) \\
2020
empty object plus empty array & \texttt{\{\}\ +\ []} & \texttt{0} (number zero) \\
2121
empty object plus empty object & \texttt{\{\}\ +\ \{\}} & \texttt{NaN} (not a number) \\
22-
\caption{Surprising Results}
23-
\label{t:legacy-surprises}
22+
\caplbl{Surprising Results}{t:legacy-surprises}
2423
\end{longtable}
2524

2625
In order to understand this, we need to know several things

pdf-settings.tex

+6-8
Original file line numberDiff line numberDiff line change
@@ -113,36 +113,34 @@
113113
\newcommand{\htmltag}[1]{{\textless}{#1}{\textgreater}}
114114

115115
% Chapters, sections, and appendices with labels.
116-
\newcommand{\chaplbl}[2]{\chapter{#1}\label{#2}}
117-
\newcommand{\seclbl}[2]{\section{#1}\label{#2}}
118116
\newcommand{\appref}[1]{Appendix~\ref{#1}}
119117
\newcommand{\chapref}[1]{Chapter~\ref{#1}}
120118
\newcommand{\figref}[1]{Figure~\ref{#1}}
121119
\newcommand{\secref}[1]{Section~\ref{#1}}
122120
\newcommand{\tblref}[1]{Table~\ref{#1}}
123121

122+
% Always put \label after \caption.
123+
\newcommand{\caplbl}[2]{\caption{{#1}\label{#2}}}
124+
124125
% Image figures.
125126
\newcommand{\figimg}[3]{\begin{figure}%
126127
\centering%
127128
\includegraphics[width=\textwidth]{#1}%
128-
\caption{#2}%
129-
\label{#3}%
129+
\caplbl{#2}{#3}%
130130
\end{figure}}
131131

132132
% PDF figures.
133133
\newcommand{\figpdf}[3]{\begin{figure}%
134134
\centering%
135135
\includegraphics[scale=0.6]{#1}%
136-
\caption{#2}%
137-
\label{#3}%
136+
\caplbl{#2}{#3}%
138137
\end{figure}}
139138

140139
% PDF figures forcing location.
141140
\newcommand{\figpdfhere}[3]{\begin{figure}[H]%
142141
\centering%
143142
\includegraphics[scale=0.6]{#1}%
144-
\caption{#2}%
145-
\label{#3}%
143+
\caplbl{#2}{#3}%
146144
\end{figure}}
147145

148146
% Exercise headings.

regexp.tex

+1-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ \chapter{Regular Expressions}\label{s:regexp}
113113
& yes & contains either ``Dr'' or ``Prof'' followed by literal '.'
114114
\\
115115

116-
\caption{Regular Expression Matches}
117-
\label{t:regexp-examples}
116+
\caplbl{Regular Expression Matches}{t:regexp-examples}
118117
\end{longtable}
119118

120119
This is a lot to digest,

server.tex

+1-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ \section{HTTP}\label{s:server-http}
104104
500 & Internal Server Error & A server error occurred while handling the request \\
105105
601 & Connection Timed Out & The server did not respond before the connection timed out
106106
\end{tabular}
107-
\caption{HTTP Status Codes}
108-
\label{t:server-codes}
107+
\caplbl{HTTP Status Codes}{t:server-codes}
109108
\end{table}
110109

111110
One final thing we need to understand is the structure and interpretation of URLs.

0 commit comments

Comments
 (0)