Document ClassesProblem with table caption

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
tomileee
Posts: 9
Joined: Tue Jul 08, 2008 11:49 am

Problem with table caption

Post by tomileee »

Hi,
i have to place the caption of a table at the top left position and for images at the standard centered bottom position.
The following code places the label of the table at top centered position, altough the switch justification=raggedleft is set.
Does anybody know why?

Code: Select all

\documentclass[a4paper,10pt]{article}
\usepackage[margin=10pt,font=small,labelfont=bf,justification=raggedleft]{caption}
\begin{document}
Table Test:
\begin{table}
\caption{Test Table}
    \begin{tabular} {|l|l|} \hline
		Item1         & Item2 \\ \hline
		\end{tabular}
    \label{tab:Test1}
\end{table}
\end{document}
Best regards,
Thomas

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Problem with table caption

Post by Stefan Kottwitz »

Hi Thomas,

single lines are centered by default, that's the behaviour of the standard classes adapted by the caption package. But you can switch it off by the option singlelinecheck=false. Perhaps you want to use raggedright, try:

Code: Select all

\usepackage[margin=10pt,font=small,labelfont=bf,justification=raggedright,singlelinecheck=false]{caption}
Stefan
LaTeX.org admin
tomileee
Posts: 9
Joined: Tue Jul 08, 2008 11:49 am

Re: Problem with table caption

Post by tomileee »

Thank you very much Stefan, now it works.
Post Reply