2

I started learning xtab package. Just for a trial, I wanted to try the code given in the documentation. But it generates the error:

\@sharp ->{\captionsize \bfseries \tablename \ \thetable{} -- concluded fro....
 l.20 \begin{xtabular}{|l|p{0.5\textwidth}|}

 ?

Here is the code:

\documentclass[12pt]{article}
\usepackage{xtab}
\begin{document}
\topcaption{The principal xtab package commands} \label{tab:xtab}
\tablefirsthead{\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tablehead{\multicolumn{2}{c}%
{{\captionsize\bfseries \tablename\ \thetable{} --
continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tablelasthead{\multicolumn{2}{c}%
{{\captionsize\bfseries \tablename\ \thetable{} --
concluded from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tabletail{\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline}
\tablelasttail{\hline \hline}
\begin{center}
\begin{xtabular}{|l|p{0.5\textwidth}|}
\verb|\begin{xtabular}{...}| & This is equivalent to the normal
\verb|\begin{tabular}{...}| environment.
You supply the specification of the columns
just as for the normal \Lenv{tabular} environment.
\\
&
All commands that can be used within a \Lenv{tabular}
environment can also be used within
the \Lenv{xtabular} environment.
\\
&
Unlike the \Lenv{tabular} environment which prevents page breaking
within the tabular, the \Lenv{xtabular} allows page breaking, so that
tabulars can extend automatically across several pages.
... ... ...
\verb|\tablelasttail{...}| & The contents of this command are inserted before
the final (internal) \verb|\end{tabular}| of the table.
\\
&
For example, you might want to note that this is where
the table ends.
\\
\end{xtabular}
\end{center}
\end{document} 
subham soni
  • 9,673

1 Answers1

5

You were missing the caption package, a definition of \Lenv and a \\ in the table:

But mainly I wanted to comment on the fact that you had reformatted the error message in your question making it not understandable; The error is

! Undefined control sequence.
\@sharp ->{\captionsize 
                        \bfseries \tablename \ \thetable {} -- concluded fro...
l.21 \begin{xtabular}{|l|p{0.5\textwidth}|}

? 

which shows you that the undefined command (the last token before the linebreak) is \captionsize You had reflowed it so it was impossible to see from your question which was the undefined command (but helpfully you provided a MWE which provided the actual error message)

\documentclass[12pt]{article}
\usepackage{xtab,caption}
\newcommand\Lenv{\textsf}
\begin{document}
\topcaption{The principal xtab package commands} \label{tab:xtab}
\tablefirsthead{\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tablehead{\multicolumn{2}{c}%
{{\captionsize\bfseries \tablename\ \thetable{} --
continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tablelasthead{\multicolumn{2}{c}%
{{\captionsize\bfseries \tablename\ \thetable{} --
concluded from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tabletail{\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline}
\tablelasttail{\hline \hline}
\begin{center}
\begin{xtabular}{|l|p{0.5\textwidth}|}
\verb|\begin{xtabular}{...}| & This is equivalent to the normal
\verb|\begin{tabular}{...}| environment.
You supply the specification of the columns
just as for the normal \Lenv{tabular} environment.
\\
&
All commands that can be used within a \Lenv{tabular}
environment can also be used within
the \Lenv{xtabular} environment.
\\
&
Unlike the \Lenv{tabular} environment which prevents page breaking
within the tabular, the \Lenv{xtabular} allows page breaking, so that
tabulars can extend automatically across several pages.
... ... ...\\
\verb|\tablelasttail{...}| & The contents of this command are inserted before
the final (internal) \verb|\end{tabular}| of the table.
\\
&
For example, you might want to note that this is where
the table ends.
\\
\end{xtabular}
\end{center}
\end{document} 
David Carlisle
  • 757,742
  • There seem to be 2 badboxes. I enabled the draft mode but still couldnt detect them. Whats the issue? – subham soni May 29 '14 at 12:27
  • @subhamsoni the log shows you the line, the first is Underfull \hbox (badness 2884) in paragraph at lines 22--27 []\OT1/cmr/m/n/12 This is equiv-a-lent to the nor-mal which just means that line is over-stretched and if you look at it you will see the inter word spaces are large, the other case is similar. This is normal if you try to justify text in narrow columns, you could use \sloppy to allow space to stretch without warning, or (often better) use \raggedright setting rather than try to justify the lines or you could ignore the warning – David Carlisle May 29 '14 at 12:39