2

i am trying to align a caption to the top left of my table and for every single table i will be using on my document, the problem is, i found here is this forum the solution for similar problems like this, but for me didn't work, the caption was aligning to the left of the document, so it would end up hanging, i couldn't find the solution, here is the code

\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}

I would appreciate any help.

2

enter image description here

(red lines shows page layout)

By use of threeparttable and replace copyrightbox with \multicolumn cell at bottom of 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}

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.