12

I'm trying to make a list of symbols that looks a lot like the one shown here:

enter image description here

But I'm having some trouble making 2 columns that are spaced in that manner for the 2 pages I have for my list.

Can anybody give me a quick tip on how I may be able to implement this, while keeping the 2 column format only for these two pages?

1

2 Answers 2

17

In the following example mathematical symbols and textual abbreviations are declared with

\newmathsymb{<name>}{<symbol without $>}{<meaning>}
\newtextsymb{<abbreviation/name>}{<meaning>}
\newtextsymb[<name>]{<abbreviation>}{<meaning>}

Example:

\newmathsymb{approx}{\approx}{approximately equal to}
\newtextsymb{ABC}{Alphabet}
\newtextsymb[TeX]{\TeX}{The \TeX\ program}

The <name> is used to identify the symbol/abbreviation. It is used inside \label (for the page number).

In the text, the symbols can be used with

\symb{<name>}

because the symbol code is remembered since its declarations (it will be needed in the list of symbols).

Remarks to the example.

  • The implementation assumes, that the list of symbols is printed after the symbol declarations. Otherwise the code of the symbols would have to be stored in the auxiliary file.

  • The list of symbols is set in a table that breaks across columns and pages that is supported by package supertabular. Package longtable does not support two column mode.

  • Table supertabular sets each column in a separate tabular environment. Because of this the widths of the columns might vary across columns. Therefore the width of the first two columns are fixed by using p columns. It is assumed that the header for the third column (Page) is larger than the largest page number. The width of the first column is calculated by measuring the width of all symbols. The second column gets the remaining width.

  • The page number is remembered by \label, when the symbol is declared.

  • The first line of the second column is aligned with the symbol, the bottom line is aligned with the page number. This is solved by aligning all columns at the top line. The cell for the second column is set twice to get the difference between the top and bottom line. The page number is then be lowered by this difference.

  • The list of symbols has different line spacings, narrower inside a cell. This is achieved by different settings of \arraystretch.

The example file:

\documentclass[a4paper,12pt]{article}
\usepackage[
  hmargin=25mm,
]{geometry}
\usepackage{supertabular}
\usepackage{array}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\makeatletter
\newcommand*{\symb@list}{}
\newlength{\symb@maxwidth}
\newlength{\symb@meaning}
\newcommand*{\new@symb}[3]{%
  \@bsphack
  \g@addto@macro{\symb@list}{\symb@do{#1}{#2}{#3}}%
  \label{symb:#1}%
  \expandafter\gdef\csname symb:#1\endcsname{#2}%
  \begingroup
    \settowidth{\dimen@}{#2}%
    \ifdim\dimen@>\symb@maxwidth
      \global\symb@maxwidth=\dimen@
    \fi
  \endgroup
  \@esphack
}
\newcommand*{\newmathsymb}[3]{%
  \new@symb{#1}{\ensuremath{#2}}{#3}%
}
\newcommand*{\newtextsymb}{%
  \@dblarg\symb@newtext
}
\def\symb@newtext[#1]#2#3{%
  \new@symb{#1}{#2}{#3}%
}
\newcommand*{\symb}[1]{%
  \@ifundefined{symb:#1}{%
    \@latex@error{Symbol `#1' is undefined}\@ehc
  }{%
    \csname symb:#1\endcsname
  }%
}
% List of symbols
\newcommand*{\symb@head}[1]{\textbf{\large#1}}
\newcommand*{\printsymblist}{%
  \twocolumn[%
    \section*{%
      \centering
      List of Symbols, Abbreviations, and Notation%
    }%
  ]%  
  \thispagestyle{empty}% optional
  \renewcommand*{\arraystretch}{1.1}%
  \settowidth{\dimen@}{\symb@head{Symbol}}%
  \ifdim\dimen@>\symb@maxwidth
    \global\symb@maxwidth\dimen@
  \fi
  \setlength{\symb@meaning}{\linewidth}%
  \addtolength{\symb@meaning}{-\symb@maxwidth}%
  \settowidth{\dimen@}{\symb@head{Page}}%
  \addtolength{\symb@meaning}{-\dimen@}% 
  \addtolength{\symb@meaning}{-4\tabcolsep}%
  \tablehead{%
    \symb@head{Symbol} & \symb@head{Meaning} & \symb@head{Page}\\[.5ex]%
  }%
  \begin{supertabular}{@{}p{\symb@maxwidth}p{\symb@meaning}c@{}}%
    \symb@list
  \end{supertabular}%
  \clearpage
  \onecolumn
}
\newcommand*{\symb@do}[3]{%
  #2&%
  \sbox0{%
    \renewcommand*{\arraystretch}{1}%
    \begin{tabular}[t]{@{}p{\symb@meaning}@{}}%
      \raggedright
      #3%
    \end{tabular}%
  }%
  \sbox2{%
    \renewcommand*{\arraystretch}{1}%
    \begin{tabular}[b]{@{}b{\symb@meaning}@{}}%
      \raggedright
      #3%
    \end{tabular}%
  }%
  \usebox0 %
  \xdef\symb@raise{\the\dimexpr\ht0-\ht2}%
  &\raisebox{\symb@raise}{\pageref{symb:#1}}\tabularnewline
}
\makeatother

\begin{document}
\setcounter{page}{40}
\newmathsymb{ABline}{\overleftrightarrow{AB}}{line $AB$}
Text with \symb{ABline} in text mode.
\begin{equation}
  \symb{ABline} = \symb{ABline}
\end{equation}
\newpage
\newmathsymb{ABsegment}{\overline{AB}}{line segment $AB$}
Text with \symb{ABsegment}.
\newmathsymb{AB}{AB}{the length of \symb{ABsegment}}
\newmathsymb{ABray}{\overrightarrow{AB}}{ray $AB$}  
\newpage
\newmathsymb{angleABC}{\angle ABC}{angle $ABC$}
Text with \symb{angleABC}.

\newcommand*{\test}[1]{%
  \newpage
  \setcounter{page}{#1}%
  Dummy text.%
}
\test{42}\newtextsymb{degree}{\textdegree}{degree}
\test{88}\newmathsymb{approx}{\approx}{approximately equal to}
\test{108}\newmathsymb{pi}{\pi}{pi}
\test{186}\newmathsymb{if p then q}{p \Rightarrow q}{if $p$, then $q$}
\test{189}\newmathsymb{p iff q}{p \Leftrightarrow q}{$p$ if and only if $q$}
\test{198}\newtextsymb{HL}{Hypotenuse-Leg Congruence Theorem}
\test{198}\newtextsymb[CP]{C.P.}{\textbf{C}orresponding \textbf{P}arts
  of Congruent Triangles Are Congruent}
\test{199}\newtextsymb{ASA}{Angle-Side-Angle Congruence Postulate}
\test{298}\newmathsymb{a:b}{a\colon b}{ratio $\frac{a}{b}$}
\test{309}\newtextsymb{AAA}{Angle-Angle-Angle Similarity Postulate}
\test{309}\newtextsymb{AA}{Angle-Angle Similarity Theorem}
\test{310}\newtextsymb{SAS}{Side-Angle-Side Similarity Theorem}{310}
\test{311}\newtextsymb{LL}{Leg-Leg Similarity Theorem}
\test{541}\newmathsymb{>}{>}{is greater than}
\test{541}\newmathsymb{<}{<}{is less than}   
\test{541}\newmathsymb{<=}{\neq}{is less than or equal to}
\test{541}\newmathsymb{>=}{\geq}{is greater than or equal to}
\test{562}\newmathsymb{dT}{d_T}{taxicab distance}{562}
\test{562}\newmathsymb{dE}{d_E}{Euclidian distance}{562}

\printsymblist

\end{document}

Result

Symbol list before symbol definitions

In my answer to a follow-up question "Problem with symbol list" I have modified the code to put the symbol definition in the .aux file. Then the list of symbols can also be used at the start of the page.

3
  • How can I change the two-column into one-column? And, \printsymblist does not work on the front page.
    – Maryà
    Mar 25, 2021 at 23:58
  • 1
    @Maryà The definition of \printsymbolist starts with \newcommand*{\printsymblist}{% \twocolumn[...]. Thus, it should not be too hard to change that (maybe with the help of a LaTeX reference). Mar 26, 2021 at 18:30
  • 1
    @Maryà For the problem with the symbol list on the front page, this is answered in the last section "Symbol list before symbol definitions" of the answer. Mar 26, 2021 at 18:32
-1

You should look into using the \tabcolsep length which determines the length between consecutive columns. That will produce that amount of space between two columns.

If however, you wish different spacing of different columns, you can use the p{<length>} specifier which sets the width of the column to <length>.

Below are examples of the normal table, with a \tabcolsep and with the p specifier.

\documentclass{article}
\begin{document}
\begin{tabular}{cc}
  \hline
  Hello & there\\\hline
  where & am \\\hline
  I & ? \\\hline  
\end{tabular}
\qquad\tabcolsep=15pt
\begin{tabular}{cc}
  \hline
  Hello & there\\\hline
  where & am \\\hline
  I & ? \\\hline  
\end{tabular}
\qquad
\begin{tabular}{p{1cm}p{2cm}}
  \hline
  Hello & there\\\hline
  where & am \\\hline
  I & ? \\\hline  
\end{tabular}
\end{document}

Which will produce the following: enter image description here

You should be able to use this for your symbol table.

If then you wish centering inside a p specifier you should use the array package and specify the columns as this (which will center the 1st column):

% \usepackage{array}
\begin{tabular}{>{\centering}p{1cm}p{2cm}}
  \hline
  Hello & there\\\hline
  where & am \\\hline
  I & ? \\\hline  
\end{tabular}

The output will be:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .