创建新命令,这样您就不必手动输入特定标题

创建新命令,这样您就不必手动输入特定标题

我有一个问题。我的图表应该有一个标题,<Caption> - Own representation, based on [1].如您所见,我正在写Own representation, based on [<literature>]。是否有选项可以创建新命令,例如,\captionauto[CRIPS-DM]{~\cite{einstein}}提供与相同的输出\caption[CRIPS-DM]{CRIPS-DM - Own representation, based on ~\cite{einstein}}。这样我就不必总是手写- Own representation, based on

提示:- Own representation, based on [<literature>]不应出现在图形列表中。

是否有一个选项可以创建一个新命令,而我不需要手写- Own representation, based on

\caption[CRIPS-DM]{CRIPS-DM - Own representation, based on ~\cite{einstein}}
\captionauto[CRIPS-DM]{~\cite{einstein}}

最有价值球员

\documentclass{article}
\RequirePackage{filecontents}
\usepackage{graphicx}
\begin{filecontents*}{\jobname.bib}
@article{einstein,
  author  = {Albert Einstein},
  title   = {{Zur Elektrodynamik bewegter Körper}. ({German}) 
             [{On} the electrodynamics of moving bodies]},
  journal = {Annalen der Physik},
  volume  = {322},
  number  = {10},
  pages   = {891--921},
  year    = {1905},
  DOI     = {http://dx.doi.org/10.1002/andp.19053221004},
}
@online{ApoG,
  Address = {03.08.2013},
  Edition = {15.10.1980},
  Publisher = {juris GmbH},
  Title = {ApoG - Gesetz {\"u}ber das Apothekenwesen},
  Url = {www.juris.de/purl/gesetze/_ges/ApoG},
  Year = {1980},
}
\end{filecontents*}
\usepackage[ngerman]{babel}
\usepackage[%
backend=bibtex      % biber or bibtex
%,style=authoryear    % Alphabeticalsch
,style=numeric-comp  % numerical-compressed
,sorting=none        % no sorting
,sortcites=true      % some other example options ...
,block=none
,indexing=false
,citereset=none
,isbn=true
,url=true
,doi=true            % prints doi
,natbib=true         % if you need natbib functions
]{biblatex}
\DefineBibliographyStrings{ngerman}{%
    urlseen = {aufgerufen am}
}


\addbibresource{\jobname.bib}  % better than \bibliography

\begin{document}

\listoffigures

\begin{figure}
    \centering
    \includegraphics[width=\textwidth]{example-image-a}
    \caption[CRIPS-DM]{CRIPS-DM - Own representation, based on ~\cite{einstein}}
    \label{fig:figure1}
\end{figure}

%Let's cite! The Einstein's journal paper ~\cite{einstein} are physics related items. Lorem 
\printbibliography[title=Literaturverzeichnis]

\end{document}

答案1

我认为你不需要可选参数。据我所知,你希望第一个参数\captionauto用作短标题,然后用作长标题,后面跟着引文。比如

\newcommand*{\citecaption}[2]{%
   \caption[#1]{#1 --- Own representation, based on~\cite{#2}.}%
}

然后你可以使用它作为

\citecaption{CRIPS-DM}{einstein}

相关内容