Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Ihave stumbled upon strange behavior (at least for me). I am generating a document composed of a set of blank framed boxes, each with a text attached above, and it will always be most likely necessary to span more than page. But as soon as the number of boxes-texts warrants a new page, pdfLaTeX simply refuses to do so, throwing a "Missing $ inserted" error.

I'm attaching my source, trying as much as possible to keep it short. The companylogo is placed next to this .tex file (But curious enough, it does not appear in the output).

Thank you.

\documentclass[12pt,lettersize,twoside,twocolumn]{article}

\usepackage[utf8]{inputenc}
\usepackage[spanish,es-tabla]{babel}  % The original content is written in spanish.
\usepackage[fixlanguage]{babelbib}
\usepackage{amssymb,amsmath}
\usepackage{graphicx}   
\usepackage{array}   
\usepackage{caption}
\usepackage{subcaption}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{calc}
\usepackage{stfloats}
\usepackage{fixltx2e}

% Document margins
\usepackage[top=1cm, bottom=1cm, left=1cm, right=1cm]{geometry}

% Headers Config.
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\renewcommand{\headrulewidth}{0.4pt}
\setlength{\headheight}{2.5cm} 
\addtolength{\textheight}{-2.22cm}
\fancyhead[LO,RE]{\includegraphics[height=2.22cm]{companylogo}}
\fancyhead[LE,RO]{}

% Footers Config.
\fancyfoot{}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[C]{\thepage} 
% Use dot as decimal point
\decimalpoint
% Enable page-broken equations
\allowdisplaybreaks[2]
% Command macros
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\newcommand{\emptybox}[2]{\fbox{\begin{minipage}{#1}\hfill\vspace{#2}\end{minipage}}}
\newcommand{\elembox}[1]{\begin{center}#1 \\ \emptybox{3cm}{3cm} \end{center}}

\title{SomeTitle}

% Remove author and date info from title
\makeatletter
\renewcommand{\@maketitle}{
 \vspace{-2cm}
 \begin{center}%
  {\LARGE \@title}%
 \end{center}%
 \par} \makeatother

\begin{document}
\maketitle

\elembox{1206 (1)}
\elembox{2512 (2)}
\elembox{0805 (1)}
\elembox{carbon-resistor-0.5W (1)}
\elembox{oar-5 (1)}
\elembox{1206 (2)}
\elembox{0603 (2)}
\elembox{2416 (1)}
\elembox{oar-5 (1)}
\elembox{carbon-resistor-0.5W (1)}
\elembox{qfn40 (1)}
\elembox{dip44 (2)}
% Up to this many \elemboxes this compiles. but if you uncomment the one below, BOOM.

% \elembox{dip8 (2)}
% More \elemboxes to follow, but starting from the one above, pdfLaTeX throws the error.

\end{document}
share|improve this question
1  
That's the point at which you get a page break. If I uncomment the last one I get the error that companylogo is not found. If I replace the includegraphics with "AAAA" it works without error, so I guess it is failing while reading the eps file to find the bounding box. –  David Carlisle May 8 '12 at 19:59
1  
I don't get any error (at least not after using the demo option for graphicx to ignore the missing companylogo). I enabled the last \elembox, which should have been enabled from the start. Examples should always produce the error. –  Martin Scharrer May 8 '12 at 20:00
    
If I use one of my images instead of your logo, your example works OK in my system. What happens if you add demo to graphicx; i.e., if you load the package like this: \usepackage[demo]{graphicx}? –  Gonzalo Medina May 8 '12 at 20:00
2  
I seem to remember that the spanish babel setup has some "interesting" catcode assignments which may trip up characters that appear in that file if they appear before the bounding box. –  David Carlisle May 8 '12 at 20:02
    
Thank you all for your comments. I didn't know about the demo option in graphicx. The code compiled correctly with this option set. In other to make it work without it (and so making the companylogo appear), I had to use the file's absolute path (I was using the path relative to ~/, which seems not to work. I have always worked with relative paths containing ../ without an issue. –  Luis E. May 10 '12 at 13:04

1 Answer 1

up vote 3 down vote accepted

As pointed out in the comments your code works well.

Something goes wrong with your picture. However LaTeX can handle relative paths.

A relative path is setup with ../. You can also use \graphicspath:

How to use \graphicspath + epstopdf

Note that spaces in paths need special handling.

There might also be a problem in using ~/ for denoting a path, as ~ has special meaning. You might try \string~/ instead.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.