# A “non-sciency” LaTeX book

One of my “customers” wanted a book that didn’t look so “sciency” (i.e., less like LaTeX). So here are a few tweaks to match their expectations.

Chapters should have letters as references with the prefix “Teil”:

\renewcommand{\thechapter}{Teil \Alph{chapter}}


Sections have the letter, a hyphen and the number:

\renewcommand*{\thesection}{\Alph{chapter}-\arabic{section}}


Figures have no numbers, only the caption text below (using the package caption):

\usepackage{caption}
\captionsetup[figure]{labelformat=empty,textfont=footnotesize}
\renewcommand{\thefigure}{}


The first line of a paragraph is not indented. To compensate, the space between paragraphs is bigger:

\setlength\parindent{0pt}


The header line of a page contains no section, but only the name of the chapter (using the package scrlayer-scrpage):

\usepackage{scrlayer-scrpage}
\clearpairofpagestyles % empty default header/footer markings
\automark[chapter]{chapter} % only chapter as mark
\ohead{\pagemark} % outer margin has page number


# Plot legend in figure caption

If you have a plot and add names to the data series with \addlegendentry{}, a legend is added to the plot that specifies the names for the lines or bars. This is an example plot from my thesis:

\begin{figure}
\begin{tikzpicture}
\begin{axis}[myplot]
\addplot plot coordinates {(1, 0.17) (2, 0.13) (3, 0.09) (4, 0.06) (5, 0.01) (6, 0.01)};
\addplot plot coordinates {(1, 0.13) (2, 0.16) (3, 0.16) (4, 0.14) (5, 0.14) (6, 0.13)};
\end{axis}
\end{tikzpicture}
\caption{Results (Precision) at different $k$ for the two systems}
\end{figure}


You can influence the placement and appearance of the legend and it looks really professional. Most of the time that will be exactly what you want. But not always. I wanted the legend to be embedded in the text of the caption (long story why). And this is possible and even quite simple! You just need to define a label for the data series and when you refer to that label, a picture of the line and marker is drawn as the reference.

\begin{figure}
\begin{tikzpicture}
\begin{axis}[myplot]
\addplot plot coordinates {(1, 0.17) (2, 0.13) (3, 0.09) (4, 0.06) (5, 0.01) (6, 0.01)};
\label{tikz:System1}
%\addlegendentry{System1} % remove to get rid of legend
\addplot plot coordinates {(1, 0.13) (2, 0.16) (3, 0.16) (4, 0.14) (5, 0.14) (6, 0.13)};
\label{tikz:System2}
\caption{Results (Precision) at different $k$ for the two systems \ref{tikz:System1} System 1 and \ref{tikz:System2} System 2}