Graphics, Figures & Tables ⇒ Formatting tables, captions in preamble?
Formatting tables, captions in preamble?
I would like to avoid having to format each cell to a specific font size. Also I can't seem to get bolded font for the captions.
Is there a way to do this in the preamble?
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Formatting tables, captions in preamble?
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[font=small,textfont=bf]{caption}
\usepackage{booktabs}
\usepackage{lmodern}
\usepackage{blindtext}
\parindent0em
\begin{document}
\blindtext
\begin{table}[!ht]
\centering
\small
\caption{Dummy table}\label{tab:dummy}
\begin{tabular}{cc} \toprule
Measurement & Value \\ \midrule
1 & 49587 \\
2 & 39509 \\
3 & 17389 \\ \bottomrule
\end{tabular}
\end{table}
\blindtext
\end{document}
Code: Select all
texdoc babel
Best regards and welcome to the board
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Formatting tables, captions in preamble?
a small addition:
To change the font size global you can define your own environment:
Code: Select all
\documentclass[english]{article}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage[bf]{caption}
\captionsetup[table]{position=above}
\newenvironment{mytable}[1][htb]
{\begin{table}[#1]\small\centering}%
{\end{table}
}
\begin{document}
\blindtext
\begin{mytable}[ht]
\caption{position ht}
\begin{tabular}{cc}
1 & 4 \\
\end{tabular}
\end{mytable}
\blindtext
\begin{mytable}
\caption{position p}
\begin{tabular}{cc}
1 & 4 \\
\end{tabular}
\end{mytable}
\end{document}

Re: Formatting tables, captions in preamble?
Thanks again.
Formatting tables, captions in preamble?
Figure 2: Figure 2 caption is bold
How about the 'Figure #' and 'Table #' parts?
Formatting tables, captions in preamble?
have you read the documentation of caption? Thorsten gave you the url. What do you mean with
regardsFigure 2: Figure 2 caption is bold
How about the 'Figure #' and 'Table #' parts?
Marco

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Formatting tables, captions in preamble?
A look at the manual of the package yields the solution. Simply change the options of package inclusion.fini_fly wrote:I've tried both of your suggestions and they work to a point as I can only get the caption to be bolded. For example:
Figure 2: Figure 2 caption is bold
How about the 'Figure #' and 'Table #' parts?
Code: Select all
\usepackage[font={small,bf}]{caption}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Formatting tables, captions in preamble?
Code: Select all
\usepackage[font={footnotesize,bf}]{caption}