3

My document is creating a {blank rest of page + empty page} before a tabularx table.

Checked this thread with no dice - I couldn't solve with typical figure/table placement controls.

This is my code:

\chapter{List of Symbols} 
\label{ch:AE}
\begin{tabularx}{1\textwidth}{>{\hsize=.2\hsize$}l<{{}$}>{\hsize=28\hsize}X}[H]
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\ 
...
\end{tabularx}

Pictures of results are below - you can see in the third pic that the [H] ends up being read as part of the first column.

I'm not that familiar with tabularx, any ideas??

Thanks for help -DR

enter image description here

enter image description here

enter image description here

DSRadin
  • 33
  • The table is larger than the vertical space available in the chapter title page. – egreg Mar 04 '15 at 23:11
  • @egreg -- that explains the empty page with the title, but what about the empty second page? – barbara beeton Mar 04 '15 at 23:12
  • add \usepackage{ltablex} to your document – touhami Mar 04 '15 at 23:13
  • @barbarabeeton Probably because the table is even larger than the space available in a page. – egreg Mar 04 '15 at 23:13
  • The argument of the second \hsize should be 1.8, not 28. – Mico Mar 04 '15 at 23:17
  • @Mico you'd think so, right? It was doing some crazy stunts - 1.8 made the column about 5 characters wide. I had to expand it to 28 to get it to be normal width. I thought it was supposed to add to 2, but that busted. – DSRadin Mar 04 '15 at 23:20
  • Your tabularx setup is suspect: the type of the first column (given that you're playing with 0.2\hsize) should be X, not l. That way, and with 1.8\hsize for the second column, the second will be 9 times as wide as the first, with the entire table taking up \textwidth. The [H] stuff does nothing useful, by the way -- or is it supposed to be part of the very first cell (in which place its location is very confusing)? – Mico Mar 04 '15 at 23:22
  • [H] is text data in the first cell of the table in your source, that's why it is typeset that way. – David Carlisle Mar 04 '15 at 23:31
  • Given the input it's not surprising that tabularx was doing "crazy stunts" the documentation was I thought pretty explicit that you should not change the total hsize of all the X columns. You only have 1 X column so no change of \hsize is possible and you have multiplied it by 28! (setting \hsize in an l column has no effect at all as there is no line breaking in l columns) – David Carlisle Mar 04 '15 at 23:39
  • Using tabularx in the way you're using it, even if you load ltablex, is completely wrong. longtable is the right way here. – karlkoeller Mar 06 '15 at 17:33

3 Answers3

4

Just in case you didn't know it, there are specialized packages for printing such lists. They also add the possibility of referencing the symbols throughout the document.

One of them is glossaries. Here's an example with it:

\documentclass{book}

\usepackage[acronym,nonumberlist,numberedsection]{glossaries}

\renewcommand{\acronymname}{List of Symbols} \newglossarystyle{mystyle}{% \setglossarystyle{long}% \renewenvironment{theglossary}% {\begin{longtable}[l]{@{}p{0.1\hsize}p{0.8\hsize}}}% {\end{longtable}}% }

\newacronym{HA}{$[H]a$}{Semi-major axis of Earth} \newacronym{ANT}{$Ant_k$}{Antenna number $k$}

\makeglossaries

\begin{document}

The symbol \acrshort{HA}

\glsaddall

\appendix \printglossary[style=mystyle,type=\acronymtype]

\end{document}

Output:

enter image description here

To obtain the output, you have to run

pdflatex myfile

makeglossaries myfile

pdflatex myfile

pdflatex myfile

If you don't have Perl installed, replace the second step with

makeindex.exe -s myfile.ist -t myfile.alg -o myfile.acr myfile.acn

karlkoeller
  • 124,410
4

If you don't want to change to change much of your code, simply use a longtable instead of a tabularx.

MWE:

\documentclass{book}

\usepackage{array,longtable}

\begin{document}

\appendix
\chapter{List of Symbols}
\label{ch:AE}

\begin{longtable}[l]{@{}>{$}p{0.1\hsize}<{$}@{}p{0.9\hsize}@{}}
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
a & Semi-major axis of Earth \\
Ant_k & Antenna number \emph{k} \\
\end{longtable}

\end{document} 

Output:

enter image description here

karlkoeller
  • 124,410
3

The problem is that the table is too large even for being contained in a page, so first of all LaTeX pushes it on the next page because it can't be contained in the chapter title.

Then it tries to set it in the next page which again doesn't have room for it, so it pushes it to the next page and finally it gives up.

You simply don't need tabularx.

\documentclass{book}
\usepackage{setspace}

\newcommand{\sym}[2]{%
  \noindent
  \makebox[4em][l]{$#1$}% <---- adjust to suit
  #2\par
}

\onehalfspacing % you seem to be using this (avoid it, if you can)

\begin{document}

\appendix
\chapter{List of Symbols} 
\label{ch:AE}

\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}

\end{document}

enter image description here

If your descriptions are long and may end up into more than one line, you can modify the definition of \sym to ensure the description is not split across pages:

\documentclass{book}
\usepackage{setspace}

\newcommand{\sym}[2]{%
  \noindent
  \makebox[4em][l]{$#1$}% <---- adjust to suit
  \begin{minipage}[t]{\dimexpr\textwidth-4em\relax}
  #2\par\xdef\theprevdepth{\the\prevdepth}
  \end{minipage}\par\prevdepth\theprevdepth
}

\onehalfspacing % you seem to be using this (avoid it, if you can)

\begin{document}

\appendix
\chapter{List of Symbols} 
\label{ch:AE}

\sym{a}{1 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{2 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{3 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{4 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{5 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{6 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{7 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{8 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{9 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{10 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{11 Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{12 Semi-major axis of Earth Semi-major axis of Earth Semi-major axis of Earth 
  Semi-major axis of Earth Semi-major axis of Earth Semi-major axis of Earth
  Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}
\sym{a}{Semi-major axis of Earth}
\sym{Ant_k}{Antenna number $k$}

\end{document}

enter image description here

egreg
  • 1,121,712
  • 1
    Every tabularx with a preamble of lX should be forcibly removed and replaced by a list, the world would be a better place. +1 for a small step towards world harmony. – David Carlisle Mar 04 '15 at 23:34
  • This method is great except it doesn't have the same word-wrap protection that the tabularx provides. Unless I'm doing something wrong when I ran this code with "definitions" longer than 2 lines I had containment problems. – DSRadin Mar 05 '15 at 12:31
  • @DSRadin No problem: the fix is quite easy; it's the advantage of using macros, so the user input has not to be changed. – egreg Mar 05 '15 at 13:01