我的表格有问题。我认为这是因为它比页面宽度大。我不知道如何将图例左对齐,无论我做什么它仍然居中。我很感激任何帮助。这是代码:
\documentclass{article}
\usepackage{caption,booktabs}
\DeclareCaptionFormat{myformat}{\captionsetup{labelfont = bf,justification = raggedleft} #1#2\\#3}
\begin{document}
\begin{table}[htpb]
\renewcommand{\figurename}{Figure}
\renewcommand{\tablename}{Table}
\captionsetup{format = myformat}
\caption{Results for Re = 40.}
\raggedleft
\begin{tabular}{lcccccl}
\toprule
Reference & Cd & L/D & a/D & b/D & $\theta_s$ & Remark \\
\midrule
\cite{Tritton1959} & 1.57 & - & - & - & - & Experimental \\
\cite{Constanceau1977} & - & 2.13 & 0.76 & 0.59 & 53.5 & Experimental \\
\cite{Rengel1999} & 1.61 & 2.23 & 0.72 & 0.58 & 54.06 & FVM 180x180 \\
\cite{Wanderley2008} & 1.56 & 2.29 & 0.73 & 0.6 & 53.08 & FDM 200x200
\\
Present Study & 1.55 & 2.06 & 0.72 & 0.6 & 53.9 & FVM 200x200 \\
\bottomrule
\end{tabular}%
\raggedleft
\label{tab:table1}%
\end{table}%
\end{document}
答案1
如果要将标题左对齐,则应在 的参数中使用 raggedright,而不是 raggedleft \captionformat
。您还应该删除两个独立\raggedleft
指令。
您可能还想将数据列中的数字与各自的小数点对齐。以下代码给出了如何执行此操作的示例。
\documentclass{article}
\usepackage{booktabs,caption,siunitx}
\captionsetup{labelfont=bf,
justification=raggedright,
singlelinecheck=off}
\newcolumntype{T}[1]{S[table-format=#1]}
\renewcommand{\figurename}{Figure}
\renewcommand{\tablename}{Table}
\begin{document}
\begin{table}[htpb]
\caption{Results for Re = 40.}\label{tab:table1}
%%%%\raggedleft
\begin{tabular}{@{} l *{4}{T{1.2}} T{2.2} l @{}}
\toprule
Reference & {Cd} & {L/D} & {a/D} & {b/D} & {$\theta_s$} & Remark \\
\midrule
\cite{Tritton1959} & 1.57 & {--} & {--} & {--} & {--} & Experimental \\
\cite{Constanceau1977}& {--} & 2.13 & 0.76 & 0.59 & 53.5 & Experimental \\
\cite{Rengel1999} & 1.61 & 2.23 & 0.72 & 0.58 & 54.06& FVM 180$\times$180 \\
\cite{Wanderley2008} & 1.56 & 2.29 & 0.73 & 0.6 & 53.08& FDM 200$\times$200
\\
Present Study & 1.55 & 2.06 & 0.72 & 0.6 & 53.9 & FVM 200$\times$200 \\
\bottomrule
\end{tabular}
%%%%\raggedleft
\end{table}
\end{document}