
我有以下問題:我的表格是透過caption[title]{long description...}
.現在我需要將來源添加到其中一些作為添加到標題的腳註,如下例所示:
我試過這個:在圖形的 \caption 中使用 \footnote,但問題是腳註也顯示在文件開頭的表格清單中。
請注意,「紅狐狸 - 屬性」是 ,[title]
其餘文字是{long description}
,用法如下:從 scrreprt 類別中的標題新增表格標題
另外,我不會為每個標題使用腳註,因此解決方案必須靈活,因為它提供了添加腳註的選項(但不是強制性的)。
上面的格式可以嗎?
尋找一種安全有效且不會產生不良結果的解決方案。
微量元素:
\documentclass[a4paper, 12pt, headsepline, smallheadings]{scrreprt}
\usepackage[labelfont={small,bf}, textfont=small, labelsep=colon,singlelinecheck=false,format=plain, parindent=1em]{caption}
\newlength\myindention
\setlength\myindention{1em}
\usepackage{chngcntr}
\counterwithout{table}{chapter}
\let\oldcaption\caption
\renewcommand*\caption[2][]{%
\oldcaption[#1]{#1\\\hspace*{\myindention}#2}%
}
\begin{document}
\listoftables
\chapter{Introduction}
\begin{table}[h]
\caption[title table 1]{description table 1}
\fbox{content}
\end{table}
\end{document}
謝謝。
答案1
如果僅有的區別在於,有時您需要\footnotemark
在標題末尾添加 ,您可以定義一個切換(加星號的宏的概括)+
來添加它。
\documentclass{scrreprt}
\usepackage[labelfont={small,bf}, textfont=small, labelsep=colon,
singlelinecheck=false,format=plain, parindent=1em]{caption}
\usepackage{xparse}
\newlength\myindention
\setlength\myindention{1em}
\let\oldcaption\caption
\RenewDocumentCommand { \caption } { t{+} O{} m } {%
\oldcaption[#2]{%
#2%
\IfBooleanT{#1}{\footnotemark}
\\%
\hspace*{\myindention}#3
}%
}
\begin{document}
\listoftables
\chapter{Introduction}
\begin{table}[h]
\caption[title table 1]{description table 1}
\fbox{content}
\end{table}
\begin{table}[h]
\caption+[title table 2]{description table 2}
\fbox{content}
\end{table}
\footnotetext{Source.}
\end{document}
然後\caption
像在 MWE 中一樣工作並\caption+
執行相同的操作,但\footnotemark
在標題末尾(即行\IfBooleanT
)添加。為了明確起見:
- 表格來源:
\caption+[title]{description}
以及\footnotetext
之後 - 無來源表:
\caption[title]{description}
僅
答案2
不是很優雅,但它似乎確實有效:
\documentclass[a4paper, 12pt, headsepline, smallheadings]{scrreprt}
\usepackage[labelfont={small,bf}, textfont=small, labelsep=colon,singlelinecheck=false,format=plain, parindent=1em]{caption}
\newlength\myindention
\setlength\myindention{1em}
\usepackage{chngcntr}
\counterwithout{table}{chapter}
\usepackage{xparse}
\let\oldcaption\caption
\RenewDocumentCommand\caption{D [] {} D [] {} m}{%
\def\tempa{}%
\def\tempb{#1}%
\def\tempc{#2}%
\ifx\tempa\tempb\def\tempb{#3}\fi%
\ifx\tempa\tempc\let\tempc\tempb\fi%
\oldcaption[\tempb]{\tempc\\\hspace*{\myindention}#3}%
}
\begin{document}
\listoftables
\chapter{Introduction}
\begin{table}[h]
\caption[title table 1][title table 1\footnotemark]{description table 1}
\fbox{content}
\end{table}
Anywhere on the same page where the float appears\footnotetext{blah}
but at least before the next footnote\footnote{the nextone}
\end{document}
不過,我希望其他人能提出更好的建議,所以只有在時間緊迫的情況下我才會推薦這個!