7

I am quite new to Latex, and I was wondering, if there is way to change the distance between the caption and the table. If you compile this example you can understand what I mean.

\documentclass[11pt,twoside,a4paper,final,titlepage,openany]{amsbook}
\usepackage[ngerman]{babel}
\begin{document}

\begin{table}[h]
\centering
\begin{tabular}{|l|l|l|l|}
\hline
blah & blah & blah & blah \\\hline
blah & blah & blah & blah \\\hline

\end{tabular}\\
\caption{blah}
\end{table}
\end{document}

Edit: Somehow I can't change it so the ngerman isn't there, I get an error everytime I try. Maybe because I am using a4paper?

  • Welcome to TeX.SE. Great that you included your MWE! However, not all are Germans, could you edit your question to skip German characters and the requirement of the German options? – zeroth Dec 18 '13 at 13:48
  • Tables usually have the caption on top of the tabular. The space will be just fine then. Are you aware of package siunitx? There is a big difference in m and m. Btw. vertical lines are distracting – Johannes_B Dec 18 '13 at 13:52
  • Why are they distracting? Aren't the lines used to separate the columns for better readability? – Nina Dec 18 '13 at 14:05
  • Concerning units, you might find some interesting remarks over at TeXwelt. – Johannes_B Dec 18 '13 at 14:05
  • Can we take this over to the chat? On the top of the page, there is the StackExchangebutton, and from there you can go to chat. This way we do not mess up the commentaries. Or you could just read the documentation of booktabs. – Johannes_B Dec 18 '13 at 14:06
5

Changing the standard lengths \abovecaptionskip and \belowcaptionskip seems to have no effect with amsbook class.

Anyway you can load the caption package

\usepackage{caption}

and issue (adjust 5pt to your needs)

\captionsetup[table]{belowskip=5pt}

MWE

\documentclass[11pt,twoside,a4paper,final,titlepage,openany]{amsbook}
\usepackage[ngerman]{babel}
\usepackage{caption}
\begin{document}
\captionsetup[table]{belowskip=5pt}
\begin{table}[h]
\centering
\begin{tabular}{|l|l|l|l|}
\hline
blah & blah & blah & blah \\\hline
blah & blah & blah & blah \\\hline
\end{tabular}
\caption{blah}
\end{table}
\end{document} 

Output

enter image description here

3

The amsbook class requires that captions to tables are above the table, while for figures they should be below the figure. You also need no \centering, because it's automatically provided.

The class is mainly thought for submissions to the AMS, so it follows the editorial guidelines of the Society.

\documentclass[11pt,twoside,a4paper,final,titlepage,openany]{amsbook}
\usepackage[ngerman]{babel}
\begin{document}

\begin{table}[h]
\caption{blah}

\begin{tabular}{|l|l|l|l|}
\hline
blah & blah & blah & blah \\
\hline
blah & blah & blah & blah \\
\hline
\end{tabular}

\end{table}

\begin{figure}[h]

\rule{3cm}{2cm}

\caption{blah}
\end{figure}

\end{document}

enter image description here

If you want to keep the same look and feel of amsbook, but to typeset all captions below the object, here's a patch, based on the fact that the magic number 64 is the one that distinguishes between figures and tables.

\documentclass[11pt,twoside,a4paper,final,titlepage,openany]{amsbook}
\usepackage[ngerman]{babel}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makecaption}
  {\@tempcnta<64}
  {\@tempcnta<\maxdimen}
  {}{}
\makeatother

\begin{document}

\begin{table}[h]

\begin{tabular}{|l|l|l|l|}
\hline
blah & blah & blah & blah \\
\hline
blah & blah & blah & blah \\
\hline
\end{tabular}
\caption{blah}
\end{table}

\begin{figure}[h]
\rule{3cm}{2cm}

\caption{blah}
\end{figure}

\end{document}

enter image description here

1

I used packages tabularx and float.

\documentclass[11pt,twoside,a4paper,final,titlepage,openany]{amsbook}
\usepackage[ngerman]{babel}‎
‎\usepackage{tabularx}‎‎
‎\usepackage{float}‎
\begin{document}

\begin{table}[H]
\centering
\begin{tabular}{|l|l|l|l|}
\hline
blah & blah & blah & blah \\\hline
blah & blah & blah & blah \\\hline

\end{tabular}
\caption{blah}
\end{table}
\end{document}

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.