Graphics, Figures & TablesWhat's wrong with Tables after updating to TeXLive2015 ?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

What's wrong with Tables after updating to TeXLive2015 ?

Post by Cham »

I have tables that are now stopping compilation with an error message, after upgrading my LaTeX installation from TeXLive2011 to TeXLive2015. I don't understand why.

The tables were compiling perfectly with TeX2011. With TeX2015, the message reads as
Package caption Error: Can be used only in preamble.
Here's a MWE code that shows the problem. Apparently, there's something wrong in the caption setup, but I don't see what. I've consulted the caption package documentation, and didn't found the mistake yet :

Code: Select all

\documentclass[12pt,letterpaper,twoside]{book}
\usepackage{booktabs}
\usepackage[dvipsnames,table]{xcolor}
\usepackage{subfig}
\captionsetup[table]{tablename=Table,labelfont={bf,up}}

\begin{document}

\begin{table}
	\centering
\begin{tabular}{cl*5{>{\centering\arraybackslash}p{1cm}}}
	\arrayrulecolor{black}
	\toprule[1.5pt]
	\toprule[0.5pt]
	$A$ & & $B$ & $C$ & $D$ & $E$ & $F$ \\
	\midrule
	1 & Word 1 : & $1$ & $0$ & $3$ & $1$ & $1$ \\[4pt]
	2 & Word 2 : & $0$ & $1$ & $4$ & $1$ & $1$ \\[4pt]
	3 & Word 3 : & $2$ & $0$ & $3$ & $4$ & $1$ \\[2pt]
	\bottomrule[0.5pt]
	\bottomrule[1.5pt]
	\end{tabular}
	\caption[Bla bla]{Bla bla bla.}
\end{table}

\end{document}
If I remove the \captionsetup line from the preamble, the error message is gone.

So what is wrong here ? Why the error message ?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

What's wrong with Tables after updating to TeXLive2015 ?

Post by Cham »

What the ... ? Removing the option tablename=Table appears to solve the issue. But then I still don't understand what is going on.

EDIT : Apparently, the option tablename doesn't exist anymore (?), and need to be change to name only. Is that it ?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

What's wrong with Tables after updating to TeXLive2015 ?

Post by Johannes_B »

It indeed seems to be, that tablename got obsolete with time. The error you receive is quite strange though.

A few other things you might consider:

Code: Select all

\documentclass[12pt,letterpaper,twoside]{book}
\usepackage{booktabs}
\usepackage[dvipsnames,table]{xcolor}
\usepackage{subfig}% declared obsolete by the l2tabu team -> subcaption
\captionsetup[table]{name=Table,labelfont={bf,up},position=below}

\newcommand{\chamaddlinespace}{\addlinespace[4pt]}
\begin{document}

The defaultaddspace equals \the\defaultaddspace{} (.5em).
\begin{table}
	\centering
	\begin{tabular}{cl*5{>{\centering\arraybackslash$}p{1cm}<{$}}}
		\arrayrulecolor{black}
		\toprule[1.5pt]
		\toprule[0.5pt]
		$A$ & & B & C & D & E & F \\
		\midrule
		1 & Word 1 : & 1 & 0 & 3 & 1 & 1 \\\chamaddlinespace
		2 & Word 2 : & 0 & 1 & 4 & 1 & 1 \\\addlinespace
		3 & Word 3 : & 2 & 0 & 3 & 4 & 1 \\\addlinespace[2pt]
		\bottomrule[0.5pt]
		\bottomrule[1.5pt]
	\end{tabular}
	\caption[Bla bla]{Bla bla bla.}
\end{table}

\end{document}
Do you see, that the amount of dollar signs is significantly lower?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

What's wrong with Tables after updating to TeXLive2015 ?

Post by Cham »

Thanks for the reply.

So changing subfig to subcaption should be enough ? No need to change anything else ? I'm nervous with this.

EDIT : Hmm, nope. Changing my subfig to subcaption gives error messages at compilation. All my figures setings are now messedup.

I HATE this obsolete crap with LaTeX ! :evil:
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: What's wrong with Tables after updating to TeXLive2015 ?

Post by Johannes_B »

I think we had the discussion before in which i explained the diferences and advantages/disadvantages of the two packages. The comment was meant for other user who stumble over this post.

EDIT: Here it is: http://latex-community.org/forum/viewto ... 917#p88917
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

What's wrong with Tables after updating to TeXLive2015 ?

Post by sommerfee »

Cham wrote:Apparently, the option tablename doesn't exist anymore (?), and need to be change to name only. Is that it ?
No, the option tablename still exists. But it has to be used as global option on the preamble, e.g. \captionsetup{tabelname=Table}.

Code like \captionsetup[table]{tablename=Table} tries to redefine the table name at every table caption, and therefore strange things could happen, for example when used with the babel, hyperref, or subcaption package.

This was always the case, but older versions of the caption package didn't take care about the wrong usage of the "tablename" option, and newer versions of the caption package gives an error instead.
Post Reply