Page LayoutProblem with \chead

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
ijourneaux
Posts: 7
Joined: Fri Jun 11, 2010 4:07 am

Problem with \chead

Post by ijourneaux »

I thought I had this worked out but I guess I don't. Here is a chunk of code that demonstrates the problem.

When I run this through TexWorks I get a pdf document but I didn't noticed I also get a bunch of

Code: Select all

Overfull \hbox (20.71967pt too wide) in alignment at lines 16--22
 [] [] [] [] [] [] [] [] 
errors. If I change \chead{std 07-31-10} to \chead{std_07-31-10} I get the same errors but this time the pdf document is not created.

In my application that createst the tex document, I have many that run without errors. The only lines that are changing are the \chead statement which has the sample id and the line with data for the table. In my application I typically have 20-100 lines of data. It is probably an obvious mistake but for the life of me I can't find it.

Code: Select all

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{longtable}
\usepackage[margin=2.5cm]{geometry}
\usepackage{lastpage}
\pdfpagewidth 8.5in
\pdfpageheight 11in
\pagestyle{fancy}
\headheight 35pt
\lhead{NewPage Research}
\chead{std 07-31-10}
\rhead{\today}
\cfoot{\thepage\ of \pageref{LastPage}}

\begin{document}
\begin{longtable}{l*{6}{c}r}
\caption{Heidelberg Pickout Report}
\label{table:PickoutAnalysis}\\
\hline \hline
Image Number& x (cm, for rotated image)	& y (cm, for rotated image) & Intensity & White Spot Size (pixels)\\
\hline
\endhead

%This is the footer for all pages except the last page of the table...
\multicolumn{3}{l}{{Continued on Next Page\ldots}} \\
\endfoot

%This is the footer for the last page of the table...
\hline \hline
\endlastfoot
2 &    9.7 &   15.1 & 254 & 6 \\ 
\end{longtable}
\end{document}
Last edited by ijourneaux on Sat Jul 31, 2010 4:40 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Problem with \chead

Post by Montag »

Code: Select all

\chead{std_07-31-10}
must be

Code: Select all

\chead{std\_07-31-10}
=)
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Problem with \chead

Post by Stefan Kottwitz »

Your table is too wide because of the text in the first row. The error occures because the underscore is a command in math mode, but it can be used like Enrico said. Further examples needing quoting are listed here: Special LaTeX symbols.

Stefan
LaTeX.org admin
ijourneaux
Posts: 7
Joined: Fri Jun 11, 2010 4:07 am

Re: Problem with \chead

Post by ijourneaux »

Thanks. Would this issue be eliminated if I used the underscore package?

Stefan Thanks for the tip on the \hbox overflow.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Problem with \chead

Post by Stefan Kottwitz »

ijourneaux wrote:Would this issue be eliminated if I used the underscore package?
If you use \chead{std_07-31-10} after \begin{document} - yes. The package delays its change of the underscore character until the document begins.

Stefan
LaTeX.org admin
Post Reply