Table caption align top-right
You can use the \ttabbox
and \FBwidth
commands from the floatrow
package to get a caption with a width equal to the table width, and then perform an adjustment to the caption justification with the help of the caption
package:
\documentclass{article}
\usepackage[russian]{babel}
\usepackage{floatrow,caption}
\begin{document}
\ttabbox[\FBwidth]{}{%
\captionsetup{justification=raggedleft,singlelinecheck=off}
\caption{}
\begin{tabular}{|l|r|r|l|}
\hline
№ & X & Y & text \\ \hline
1 & 15000 & 16000 & 0:57 \\ \hline
2 & 16000 & 17000 & 0:19 \\ \hline
3 & 17000 & 18000 & 0:10 \\ \hline
4 & 18000 & 19000 & 0:03 \\ \hline
5 & 19000 & 20000 & 0:02 \\ \hline
6 & 20000 & 21000 & 0:01 \\ \hline
7 & 60000 & 61000 & 0:01 \\ \hline
\end{tabular}%
}
\end{document}
The requirement for traditional \caption
right/left justification implies that the table be boxed. You can do this with ctable
and caption
:
\documentclass{article}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{caption}% http://ctan.org/pkg/caption
\captionsetup[table]{justification=raggedleft,singlelinecheck=off}
\begin{document}
\ctable
[caption={Some caption}]% <options>
{|l|r|r|l|}% <column spec>
{}% <footnotes>
{% <table>
\hline
No & X & Y & Hours:Minutes \\ \hline
1 & 15000 & 16000 & 0:57 \\ \hline
2 & 16000 & 17000 & 0:19 \\ \hline
3 & 17000 & 18000 & 0:10 \\ \hline
4 & 18000 & 19000 & 0:03 \\ \hline
5 & 19000 & 20000 & 0:02 \\ \hline
6 & 20000 & 21000 & 0:01 \\ \hline
7 & 60000 & 61000 & 0:01 \\ \hline
}
\end{document}
Alternatively, you can use caption
in combination with the threeparttable
package. While threeparttable
's main function is to allow for table notes, it also restricts the caption width so that it can properly be aligned.
\documentclass{article}
\usepackage{caption}
\usepackage{threeparttable}
\begin{document}
\begin{table}[h]
\centering
\begin{threeparttable}
\captionsetup{justification=raggedleft,singlelinecheck=false}
\caption{}
\begin{tabular}{|l|r|r|l|}
\hline
№ & X & Y & Время выполнения м:сс \\ \hline
1 & 15000 & 16000 & 0:57 \\ \hline
2 & 16000 & 17000 & 0:19 \\ \hline
3 & 17000 & 18000 & 0:10 \\ \hline
4 & 18000 & 19000 & 0:03 \\ \hline
5 & 19000 & 20000 & 0:02 \\ \hline
6 & 20000 & 21000 & 0:01 \\ \hline
7 & 60000 & 61000 & 0:01 \\ \hline
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}