根据我之前的问题:第一的和第二。是否可以有与图表列表中显示的标题不同的标题?所以我想做的基本上是以下几点:
\documentclass{article}
\usepackage{mwe}% just for the example
\usepackage{linegoal}
\newcommand{\mycaption}[1]{%
\refstepcounter{figure}%
\addcontentsline{lof}{figure}{\protect\numberline{\thefigure}{\ignorespaces
#1}}
\quad\parbox[b]{\linegoal}{#1}}
\begin{document}
\listoffigures
\begin{itemize}
\item \includegraphics[scale=.15]{example-image} \mycaption{caption} \myTitleInListOfFigures{This is another text}
\item \includegraphics[scale=.2]{example-image} \mycaption{another caption} \myTitleInListOfFigures{This is another text 2235434t}
\end{itemize}
\end{document}
有人知道怎么做吗?
因此图表列表应如下所示:
1.1 This is another text
1.2 This is another text 2235434t
...
答案1
这是使用 etoolbox 包的解决方案。
\mycaption[This is another text (for list)]{caption (for body)}
如果需要另一条短信,或者只是
\mycaption{caption}
如果需要使用相同的文本
\documentclass{article}
\usepackage{mwe}% just for the example
\usepackage{linegoal}
\usepackage{etoolbox}
\newcommand{\mycaption}[2][]{%
\refstepcounter{figure}%
\addcontentsline{lof}{figure}{\protect\numberline{\thefigure}{\ignorespaces
\ifblank{#1}{#2}{#1}}}
\quad\parbox[b]{\linegoal}{#2}}
\begin{document}
\listoffigures
\begin{itemize}
\item \includegraphics[scale=.15]{example-image} \mycaption[This is another text]{caption}
\item \includegraphics[scale=.2]{example-image} \mycaption{another caption}
\end{itemize}
\end{document}