Estoy empezando a usar LaTeX ahora mismo y tengo un problema con el título de mi tabla. Estoy usando TabularX y el título se recorta con la propia tabla. ¿Quizás podrías ayudarme? ¡Gracias!
Lamento mucho que el formato del código no parezca funcionar, no sé por qué.
\documentclass[
paper=a4,
fontsize=11pt,
parskip=half*,
]{scrartcl}
\begin{document}
\usepackage{tabularx}
\usepackage[labelfont={bf},
font={footnotesize},
labelsep=space,
format=hang,
justification=raggedright,
singlelinecheck=false
]{caption}
\captionsetup[table]{aboveskip=5pt, belowskip=-5pt}
\begin{table}[!ht]
\small
\centering
\captionof{table}[RFA-Analyseergebnisse des ausgefilterten Feststoff (Partikelretention 8-15µm)]{RFA-Analyseergebnisse des ausgefilterten Feststoff (Partikelretention 8-15µm)}
\begin{tabular}{ccccccccc}
\hline
\textbf{Al} & \textbf{Ni} & \textbf{Co} & \textbf{Mn} & \textbf{Cu} & \textbf{Fe} & \textbf{P} & \textbf{Ca} & \textbf{Si} \\ \hline
10.49\% & 22.68\% & 11.74\% & 6.65\% & 1.29\% & 0.85\% & 0.79\% & 0.36\% & 0.22\% \\ \hline
\end{tabular}
\label{RFA_Filterkuchen_1}
\end{table}
\end{document}
Respuesta1
Además de deshacerse de la belowskip=-5pt
opción cuestionable, debería intentar darle a su mesa un "aspecto" más abierto y acogedor. Le sugiero que lo haga (a) usando las macros del booktabs
paquete para crear reglas horizontales bien espaciadas, (b) nonegritalos elementos en la fila del encabezado (y emplear un paquete para mhchem
componer las ecuaciones químicas), y (c) mover el %
símbolo común de las celdas de datos al título.
Por cierto, en vista del hecho de que la directiva ocurre dentro de un table
entorno, no me queda claro por qué estás usando \captionof{table}{...}
en lugar de simplemente \caption{...}
.
\documentclass[
paper=a4,
fontsize=11pt,
parskip=half*,
]{scrartcl}
%\usepackage{tabularx} % does not appear to be needed
\usepackage[font={footnotesize}, % you sure about this?
labelfont = bf,
labelsep = space,
format = hang,
justification=raggedright,
singlelinecheck=false
]{caption}
\captionsetup[table]{skip=0.5\baselineskip}
% {aboveskip=5pt, belowskip=-5pt} % huh?
\usepackage{siunitx,mhchem,booktabs}
\begin{document}
\begin{table}[htb]
\centering
\small
\caption{RFA-Analyseergebnisse des ausgefilterten
Feststoffs (Partikelretention
8--15\,\unit{\micro\meter}), in \%}
\label{RFA_Filterkuchen_1}
\begin{tabular}{@{} *{9}{c} @{}}
\toprule
\ce{Al} & \ce{Ni} & \ce{Co} & \ce{Mn} & \ce{Cu} &
\ce{Fe} & \ce{P} & \ce{Ca} & \ce{Si} \\
\midrule
10.49 & 22.68 & 11.74 & 6.65 & 1.29 &
0.85 & 0.79 & 0.36 & 0.22 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Respuesta2
Creo que deberías cambiar el belowskip
parámetro de -5pt
a 5pt
. Sin embargo, puedes usarlo solo \caption
para la mesa.
Además, te recomendaría (como principiante) que uses estesitio de bodacrear tablas con mucha facilidad
\documentclass[
paper=a4,
fontsize=11pt,
parskip=half*,
]{scrartcl}
\usepackage{tabularx}
\usepackage[labelfont={bf},
font={footnotesize},
labelsep=space,
format=hang,
justification=raggedright,
singlelinecheck=false
]{caption}
%\captionsetup[table]{aboveskip=5pt, belowskip=5pt} % <--
\begin{document}
\begin{center}
\begin{table}[!ht]
\small
\caption{RFA-Analyseergebnisse des ausgefilterten Feststoff (Partikelretention 8-15µm)}
\begin{tabular}{ccccccccc}
\hline
\textbf{Al} & \textbf{Ni} & \textbf{Co} & \textbf{Mn} & \textbf{Cu} & \textbf{Fe} & \textbf{P} & \textbf{Ca} & \textbf{Si} \\ \hline
10.49\% & 22.68\% & 11.74\% & 6.65\% & 1.29\% & 0.85\% & 0.79\% & 0.36\% & 0.22\% \\ \hline
\end{tabular}
\label{RFA_Filterkuchen_1}
\end{table}
\end{center}
\end{document}
Respuesta3
Con {NiceTabular}
de nicematrix
y su llave incorporada caption
.
\documentclass[
paper=a4,
fontsize=11pt,
parskip=half*,
]{scrartcl}
\usepackage{nicematrix,booktabs}
\begin{document}
\begin{table}[!ht]
\small
\centering
\begin{NiceTabular}
[ caption = { RFA-Analyseergebnisse des ausgefilterten Feststoff (Partikelretention 8-15µm) } ]
{@{}ccccccccc@{}}
\toprule
\RowStyle[bold]{}
Al & Ni & Co & Mn & Cu & Fe & P & Ca & Si \\
\midrule
10.49\% & 22.68\% & 11.74\% & 6.65\% & 1.29\% & 0.85\% & 0.79\% & 0.36\% & 0.22\% \\
\bottomrule
\end{NiceTabular}
\label{RFA_Filterkuchen_1}
\end{table}
\end{document}
Respuesta4
Escribiría tu tabla de la siguiente manera:
- para tabla usar
tabularray
paquete conX[c]
columnas - para las reglas de las líneas de la tabla del
booktabs
paquete - en la segunda fila escribiría datos como cantidades como se propone en
siunitx
el paquete. Paquetesbooktabs
ysiunitx
se cargan comotabularray
bibliotecas:
\documentclass[paper=a4,
fontsize=11pt,
parskip=half*,
]{scrartcl}
\usepackage[skip=1ex,
font={footnotesize},
labelfont=bf,
labelsep=space,
format=hang,
justification=raggedright,
singlelinecheck=false
]{caption}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{table}[!ht]
\centering
\caption{RFA-Analyseergebnisse des ausgefilterten Feststoff (Partikelretention 8-15µm)}
\label{RFA_Filterkuchen_1}
\begin{tblr}{colspec = { *{9}{X[c]} },
row{1} = {font=\bfseries}
}
\toprule
A & Ni & Co & Mn & Cu & Fe & P & Ca & Si \\
\midrule
\qty{10.49}{\%} & \qty{22.68}{\%} & \qty{11.74}{\%} &
\qty{6.65}{\%} & \qty{1.29}{\%} & \qty{0.85}{\%} &
\qty{0.79}{\%} & \qty{0.36}{\%} & \qty{0.22}{\%} \\
\bottomrule
\end{tblr}
\end{table}
\end{document}