Graphics, Figures & TablesCenter Caption with two Lines

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
dml
Posts: 2
Joined: Sat Jul 28, 2012 1:31 pm

Center Caption with two Lines

Post by dml »

Hi,

I have several tables with captions which have 2 lines (with a break). I would like to center but a solutions i tried don't work.

If I insert

Code: Select all

\usepackage[center]{caption}
in the options it works but I got three errors with:
Package caption Error: Usage of the 'position' option is incompatible (caption) to the 'nonfloat' package"
I can't remove the float package because I use a template which uses it.

moreover I would like to know how I get the caption under the code in a listing. At the moment I'm using:

Code: Select all

\begin{lstlisting}[language=java, caption=Captiontext, label=jeeTestKlasse, numbers=left, float=ht, stepnumber=1,tabsize=2, keywordstyle=\color{blue}] 

}\end{lstlisting}

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Center Caption with two Lines

Post by localghost »

For an adequate problem description and in order to avoid guesses and random shots please prepare a proper minimal example that contains all necessary but only relevant information in form of code.
dml wrote:[…] moreover I would like to know how I get the caption under the code in a listing. At the moment I'm using:

Code: Select all

\begin{lstlisting}[language=java, caption=Captiontext, label=jeeTestKlasse, numbers=left, float=ht, stepnumber=1,tabsize=2, keywordstyle=\color{blue}] 

}\end{lstlisting}
Please don't mix up several topics in one single thread. Open a new topic for the listings issue.


Best regards and welcome to the board
Thorsten
dml
Posts: 2
Joined: Sat Jul 28, 2012 1:31 pm

Center Caption with two Lines

Post by dml »

thank you for your reply. next time i will open two threads.

here is the example for my caption problem:

Code: Select all

\begin{table}[htbp]
	\begin{tabular}{|p{0.26\textwidth}|p{0.70\textwidth}|}\hline
		test & test \\ 
		\hline
		testentry & this is a test \\ 
		\hline
	\end{tabular}
	\caption[This is the first line]{This is the first line\\
	 Quellen: \citeweb{ChristianVogel.2008}, \citeweb{tseGmbH.2001}, \citeweb{Softwarearchitektur.2005} und \citeweb{Kelter.2003}}
\label{tab:test}
\end{table}
Here you can see what i get and what i want:
table-center-caption.png
table-center-caption.png (11.31 KiB) Viewed 7488 times
i want that both lines are centered
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Center Caption with two Lines

Post by localghost »

This is not a minimal example but only a loosely code snippet. I'll first have a look at other topics first because I can't help here at the moment.
Post Reply