我需要将标签文本移动到表格标题的末尾,但文本末尾有换行符......
\documentclass[pdf, unicode, 12pt, a4paper, oneside, fleqn]{article}
\usepackage[utf8]{inputenc}
\usepackage[T2B]{fontenc}
\usepackage[english,russian]{babel}
\usepackage{caption}
\usepackage{longtable}
\DeclareCaptionFormat{reverse}{#3#2#1}
\DeclareCaptionLabelFormat{fullparens}{\bothIfFirst{#1}{ }#2}
\DeclareCaptionLabelSeparator{fill}{\hfill}
\captionsetup[longtable]{format=reverse,labelformat=fullparens,
labelsep=fill}
\begin{document}
\begin{longtable}{|p{4.5cm}|p{11cm}|}
\caption[Caption text]{Caption text} \label{table_1} \\
\hline
\endfirsthead
\hline
Title 1 & Title 2 \\
\hline
\endhead
\hline
\multicolumn{2}{c}{\textit{Продолжение на следующей странице}}
\endfoot
\hline
\endlastfoot
1 & 2 \\
\end{longtable}
\end{document}
答案1
尝试以下字幕格式:
\DeclareCaptionFormat{reverse}{#3#2#1}
\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)\hfill}
\DeclareCaptionLabelSeparator{fill}{\vspace{-\baselineskip}\hfil\qquad }
\captionsetup{format=reverse,
labelformat=fullparens,
labelsep=fill, labelfont=bf}
或者
完整的 MWE 产生第二个标题是:
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage[english,russian]{babel}
\usepackage{caption}
\usepackage{longtable}
\DeclareCaptionFormat{reverse}{#3#2#1}
\DeclareCaptionLabelFormat{fullparens}{(\bothIfFirst{#1}{ }#2)\hfill}
\DeclareCaptionLabelSeparator{fill}{\vspace{-\baselineskip}\hfil\qquad }
\captionsetup{format=reverse,
labelformat=fullparens,
labelsep=fill, labelfont=bf}
\begin{document}
\begin{longtable}{|p{4.5cm}|p{11cm}|}
\caption[Caption text]{Very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, long caption text.} \label{table_1} \\
\hline
\endfirsthead
\hline
Title 1 & Title 2 \\
\hline
\endhead
\hline
\multicolumn{2}{c}{\textit{xxxxxxxxx xxxxxxxxxxxxx}}
\endfoot
\hline
\endlastfoot
1 & 2 \\
\end{longtable}
\end{document}
如果您希望表格标签与表格右边框对齐,请将标签分隔符的定义更改为
\DeclareCaptionLabelSeparator{fill}{\vspace{-\baselineskip}\hfill}
你将获得: