我正在尝试将标题与表格的左上角对齐,对于我将在文档中使用的每个表格,问题是,我发现这里是这个论坛针对类似问题的解决方案,但对我来说不起作用,标题与文档的左侧对齐,所以它最终会挂起,我找不到解决方案,这里是代码
\usepackage[utf8]{inputenc}
\usepackage[bottom=2cm,top=3cm,left=3cm,right=2cm]{geometry}
\usepackage[onehalfspacing]{setspace}
usepackage[T1]{fontenc}
\usepackage[table,xcdraw]{xcolor}
\usepackage{caption}
\captionsetup{
justification=raggedright,
singlelinecheck=false
}
\usepackage{copyrightbox}
\makeatletter
\renewcommand{\CRB@setcopyrightfont}{
\footnotesize
\color{black}
}
\makeatother
\begin{document}
\begin{table}[h]
\caption[Tabela 1]{Resultados experimentais para a luz vermelha.}
\label{Tabela 1}
\centering
\copyrightbox[b]{
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
& $S_0$ (mm) & $S_f$ (mm) & $\Delta s$ (mm) & $L=\frac{\Delta s}{10}$ & $2L$ & m & $\lambda$ (nm) \\ \hline
Medida 1 & 0,000 & 0,065 & & & & 20 & \\ \hline
Medida 2 & 0,003 & 0,072 & & & & 20 & \\ \hline
Medida 3 & 0,007 & 0,075 & & & & 20 & \\ \hline
\end{tabular}}
{Fonte: elaborada pelo autor.}
\end{table}
\end{document}
我将不胜感激任何帮助。
答案1
(红线表示页面布局)
通过使用threeparttable
和 替换copyrightbox
底部\multicolumn
的单元格tabular
:
\documentclass{article}
\usepackage[bottom=2cm,top=3cm,left=3cm,right=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[onehalfspacing]{setspace}
\usepackage[table,xcdraw]{xcolor}
\usepackage{array, threeparttable}
\usepackage{caption}
\captionsetup{
skip=1ex,
justification=raggedright,
singlelinecheck=false
}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{table}[ht]
\centering
\begin{threeparttable}
\caption[Tabela 1]{Resultados experimentais para a luz vermelha.}
\label{Tabela 1}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
& $S_0$ (mm) & $S_f$ (mm) & $\Delta s$ (mm) & $L=\frac{\Delta s}{10}$ & $2L$ & m & $\lambda$ (nm) \\ \hline
Medida 1 & 0,000 & 0,065 & & & & 20 & \\ \hline
Medida 2 & 0,003 & 0,072 & & & & 20 & \\ \hline
Medida 3 & 0,007 & 0,075 & & & & 20 & \\ \hline
\multicolumn{8}{@{} >{\footnotesize}l}{Fonte: elaborada pelo autor.}
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}