4

I have a master document with the following packages.

\documentclass[11pt,a4paper, twoside]{report}
 \usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{fancyhdr}
\usepackage{geometry}
\usepackage{upgreek}
\usepackage{tikz}%Rahmen der Titelseite
\usepackage{textpos}%Befehl \begin{textblock}
\usepackage{hyperref}
\usepackage{booktabs} %Für die schönen Tabellen
\usepackage{pdfpages}
\usepackage{siunitx}
\usepackage{url}
\geometry{a4paper,left=30mm,right=30mm, top=3cm, bottom=2cm} 
%\pagestyle{fancy}
    %\fancyhead[OR]{\chaptermark}
\usepackage{framed}
\usepackage{ftnxtra}
\usepackage{fnpos}

I can't get the following lines to work:

\begin{table} 
\centering
\caption{Messwerte für die spez. Wärmekapazität des Kalorimeters}
\label{Tab:Waermekap:Kal}
\begin{tabular}{p{3cm}p{3cm}} %p{Spaltenbreite} 
\toprule
 \textbf{Parameter} & \textbf{Wert}\\
\midrule
$m_\text{Warmw.}$ & $0{,}0602$\,kg\\
$m_\text{Kaltw.}$ & $0{,}1693$\,kg\\
$m_\text{Kal}$ & $0{,}2355$\,kg\\
$T_\text{Mittel}$ & $311{,}15$\,K\\
$T_\text{Kaltw.}$ & $297{,}45$\,K\\
$T_\text{Warmw.}$ & $353{,}15$\,K\\
\bottomrule
\end{tabular} 
\end{table}

When trying to compile, TexMaker sends me the error:

"! Missing # inserted in alignment preamble. &l.91 \begin{tabular}{p{3cm} p{3cm}}%p{Spaltenbreite} "

Does anyone see the mistake?

  • 1
    please fix your example, deleting the packages not needed for this problem and making it into a document that can be run to demonstrate the error. – David Carlisle Apr 16 '17 at 16:28
  • 1
    (1) welcome, (2) please make this into a complete minimal example (makes it a lot easier for others to help. (3) for large sections of code indent each line with 4 spaces (tip in the browser you can mark the code and press ctrl-k this indents all marked lines with 4 spaces). (4) learn to use the siunitx package to typeset units and their values, it can be told to use German traditions. (5) don't use \text this way, it is not what that macro is meant for. – daleif Apr 16 '17 at 16:31
4

The ftnxtra appears to break tabular. This works without error.

\documentclass[11pt,a4paper, twoside]{report}
 \usepackage[utf8]{inputenc}
\usepackage[german]{babel}

\usepackage{booktabs} %Für die schönen Tabellen

\usepackage{siunitx}

%\usepackage{ftnxtra}
\usepackage{fnpos}

\begin{document}

\begin{table} 
\centering
\caption{Messwerte für die spez. Wärmekapazität des Kalorimeters}
\label{Tab:Waermekap:Kal}
\begin{tabular}{p{3cm}p{3cm}} %p{Spaltenbreite} 
\toprule
 \textbf{Parameter} & \textbf{Wert}\\
\midrule
$m_\text{Warmw.}$ & $0{,}0602$\,kg\\
$m_\text{Kaltw.}$ & $0{,}1693$\,kg\\
$m_\text{Kal}$ & $0{,}2355$\,kg\\
$T_\text{Mittel}$ & $311{,}15$\,K\\
$T_\text{Kaltw.}$ & $297{,}45$\,K\\
$T_\text{Warmw.}$ & $353{,}15$\,K\\
\bottomrule
\end{tabular} 
\end{table}

\end{document}
|improve this answer|||||
  • Curious, as ftnxtra “fixes the issue of footnote inside \caption{}, tabular environment”, according to its short documentation. – egreg Apr 16 '17 at 17:11
  • @egreg I suspect it patches the format tabular and trips up on array package version, but I'm not too motivated to trace it too far, – David Carlisle Apr 16 '17 at 17:13
3

The ftnxtra is incompatible with the array package, which is loaded by siunitx. This is a stopper for using the package: array is among the “standard” LaTeX tools (albeit being optional).

Several packages load array, because it helps in building tables more complex than the types allowed by the kernel functions.

What happens is that ftnxtra redefines \@tabular but it's too late for doing it, if array has already been loaded.

You can load it before siunitx and any other package loading array, but I'm not sure it will do what it claims to.

\documentclass[11pt,a4paper, twoside]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{amsmath}
\usepackage{booktabs} %Für die schönen Tabellen
\usepackage{ftnxtra}
\usepackage{siunitx}
\usepackage{fnpos}
\usepackage[
  hyperfootnotes=false,% doesn't work with fnpos and ftnxtra
]{hyperref}

\sisetup{locale=DE} % German conventions for numbers

\setlength{\textheight}{8cm} % just to minimize output

\begin{document}

\begin{table} 
\centering
\caption{Messwerte für die spez. Wärmekapazität des Kalorimeters\footnote{Xyz}}
\label{Tab:Waermekap:Kal}
\begin{tabular}{p{3cm}p{3cm}S[table-format=1.1]} %p{Spaltenbreite} 
\toprule
 \textbf{Parameter} & \textbf{Wert}\\
\midrule
$m_\text{Warmw.}$            & \SI{0,0602}{\kilo\gram} & 1.1\\
$m_\text{Kaltw.}$            & \SI{0,1693}{\kilo\gram} & 0.1\\
$m_\text{Kal}$\footnote{Abc} & \SI{0,2355}{\kilo\gram}\\
$T_\text{Mittel}$            & \SI{311,15}{\kelvin}\\
$T_\text{Kaltw.}$            & \SI{297,45}{\kelvin}\\
$T_\text{Warmw.}$            & \SI{353,15}{\kelvin}\\
\bottomrule
\end{tabular} 
\end{table}

\end{document}

I added an S column just for testing, and some footnotes. Note that units should be input using \SI.

enter image description here

A couple of notes.

  1. hyperref should be loaded last (only a few packages need to go after it)
  2. Both ftnxtra and fnpos play with footnotes, so the hyperlinks break; hence it's necessary to disable them with hyperfootnotes=false: the effect is the same, that is, no hyperlinks, but, at least, you don't get annoying warnings.
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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