
У меня следующая проблема: мои таблицы отформатированы через caption[title]{long description...}
. Теперь мне нужно добавить источники к некоторым из них в виде сноски, добавленной к подписи, как в следующем примере:
Я попробовал это:Использование \footnote в \caption рисунка, но проблема в том, что сноски также отображаются в списке таблиц в начале документа.
Обратите внимание, что «Рыжая лиса - атрибуты» - это , [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}
Я ожидаю, что кто-то другой сможет предложить что-то лучшее, поэтому я бы рекомендовал это только в том случае, если время имеет решающее значение!