[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: very strange LaTeX error
From: |
Joost Kremers |
Subject: |
Re: very strange LaTeX error |
Date: |
Fri, 20 Dec 2019 13:33:43 +0100 |
User-agent: |
Cyrus-JMAP/3.1.7-694-gd5bab98-fmstable-20191218v1 |
On Fri, Dec 20, 2019, at 12:56 PM, Fraga, Eric wrote:
> #+begin_src latex
> \documentclass{scrartcl}
> \begin{document}
> % packages deleted, none of which is used anyway in the following
> \tableofcontents
>
> \section{some results}
> \label{sec:org4f5891c}
> \begin{table}[hbtp]
> \label{atable}
> \centering
> \begin{tabular}{lrrr}
> \hline
> x & z1 & z2 & g\\
> \hline
> [0.0005, 0.05, 0.5] & 90000.0 & 0.05 & 0.0\\
> [0.000787451, 0.0575948, 0.5] & 110000.0 & 0.05759476698672508 & 0.0\\
> \hline
> \end{tabular}
> \end{table}
> \end{document}
> #+end_src
>
> I get errors like this when compiling with pdflatex:
>
> #+begin_example
> ! Illegal unit of measure (pt inserted).
> <to be read again>
> ,
> l.18 [0.000787451, 0.0575948, 0.5]
> & 110000.0 & 0.05759476698672508 & 0.0\\
> ! Missing = inserted for \ifdim.
> <to be read again>
> #+end_example
>
> What am I doing wrong?
You have `[...]` in the first cell of a table row that is not the first row.
Few people seem to realise that the double backslash `\\` in LaTeX is a macro
that can actually take an optional argument, a measure specifying the height of
the newline. So when a table row ends in `\\` (which is the normal case) and
the next row starts with an opening bracket, LaTeX assumes it is looking at an
optional argument and expects a measure, i.e., a number followed by one of the
supported units.
The solution I usually opt for is to enclose the brackets in an additional set
of braces: `{[...]}`. Whether Org export can and should automate that, I can't
say.
HTH
--
Joost Kremers
Life has its moments