0

I'm looking for a way (maybe it works out of the box) or package to create a page for conventions used within a paper. Up until now my search yielded only results about typographic conventions in LaTeX and not how to create them...

Here is an example how it could look like (from here):

enter image description here

Not sure if this would be a itemize or a tabular environment (maybe the latter due to multiline) I started with tabular and this is the code:

\documentclass{article}

% surround the \dotfill by a bit of blank space \newcommand{\spaceddotfill}{\phantom{i}\dotfill\phantom{e}}

\begin{document} \begingroup \setlength\tabcolsep{0pt} \begin{tabular}{p{3.2cm}p{8.8cm}} \textsf{package}\spaceddotfill & Paketbezeichner verwenden zur Darstellung die Schriftart \textsf{Sans Serif}. \[1em] \texttt{file}\spaceddotfill & Datei- und Programmnamen verwenden zur Darstellung die Schriftart \texttt{Typewriter}. \[1em] \texttt{\textbackslash{}macro}\spaceddotfill & Makros, respektive Kommandos, werden mit einem umgekehrten Schrägstrich (backslash) eingeleitet und verwenden zur Darstellung die Schriftart \texttt{Typewriter}.\[1em] \texttt{environment}\spaceddotfill & Umgebungen verwenden zur Darstellung die Schriftart \texttt{Typewriter}. \[1em] \texttt{option}\spaceddotfill & Optionen verwenden zur Darstellung die Schriftart \texttt{Type-writer}. \[1em] \textit{defval}\spaceddotfill & Standardwerte verwenden zur Darstellung die Schriftart \textit{Italics}. \[1em] \textit{$\langle meta \rangle$}\spaceddotfill & Metadaten, also Platzhalter für Informationen jeglicher Art, verwenden zur Darstellung die Schriftart \textit{Italics} und sind zusätzlich noch in spitzen Klammern eingeschlossen. \[1em] \ttfamily${$\textit{$\langle mustarg \rangle$}$}$\spaceddotfill & Pflichtparameter werden in geschweiften Klammern einge-schlossen und verwenden zur Formatierung der Daten die Darstellung \textit{$\langle meta \rangle$}. \[1em] {[\textit{$\langle optarg \rangle$}]}\spaceddotfill & Optionale Parameter werden in eckigen Klammern einge-schlossen und verwenden zur Formatierung der Daten die Darstellung \textit{$\langle meta \rangle$}. \[1em] \end{tabular} \endgroup \end{document}

Wondering though if there are better ways to do this.

ViToni
  • 203

1 Answers1

1

The following contains some suggestions on how one could improve your code. I have removed all \spaceddotfill commands and added it directly into the column definition. Instead of the repeated [1em], I used \setlength\extrarowheight{1em} and to make sure the table fits into the textwidth, I calculated the width of the second column and added \noindent right before the start of the table. Lastly, I also used \lstinline from the listings package for the code fragments:

enter image description here

\documentclass{article}
\usepackage{array}
% surround the \dotfill by a bit of blank space
\newcommand{\spaceddotfill}{\phantom{i}\dotfill\phantom{e}}
\usepackage{listings}
\lstset{basicstyle=\itshape}
\begin{document}
\begingroup
\setlength\extrarowheight{1em}
\setlength\tabcolsep{0pt}
\noindent
\begin{tabular}{p{3.2cm}<{\spaceddotfill}p{\dimexpr\textwidth-3.2cm}}
    \textsf{package} & Paketbezeichner verwenden zur Darstellung die Schriftart \textsf{Sans Serif}. \\
    \texttt{file} & Datei- und Programmnamen verwenden zur Darstellung die Schriftart \texttt{Typewriter}. \\
    \texttt{\textbackslash{}macro} & Makros, respektive Kommandos, werden mit einem umgekehrten Schrägstrich (backslash) eingeleitet und verwenden zur Darstellung die Schriftart \texttt{Typewriter}.\\
    \texttt{environment} & Umgebungen verwenden zur Darstellung die Schriftart \texttt{Typewriter}. \\
    \texttt{option} & Optionen verwenden zur Darstellung die Schriftart \texttt{Type\-writer}. \\
    \textit{defval} & Standardwerte verwenden zur Darstellung die Schriftart \textit{Italics}. \\
    \lstinline|<meta>| & Metadaten, also Platzhalter für Informationen jeglicher Art, verwenden zur Darstellung die Schriftart \textit{Italics} und sind zusätzlich noch in spitzen Klammern eingeschlossen. \\
    \lstinline|{<mustarg>}| & Pflichtparameter werden in geschweiften Klammern einge\-schlossen und verwenden zur Formatierung der Daten die Darstellung \lstinline|<meta>|. \\
    \lstinline|[<optarg>]| & Optionale Parameter werden in eckigen Klammern einge\-schlossen und verwenden zur Formatierung der Daten die Darstellung \lstinline|<meta>|. \\
\end{tabular}
\endgroup

\end{document}

leandriis
  • 62,593
  • Great solution, thanks. Very elegant using the \spaceddotfill in the column definition. Thanks for pointing out \setlength\extrarowheight{1em}, I didn't know about it and it is very usefull for other places, too. – ViToni Nov 08 '20 at 21:03