语言, Latex专题

在Latex附录文件中的图片和公式序号前面加个'S'字母

如果需要在Latex附录文件中的图片和公式序号前面都加个'S'字母,可增加语句:

\renewcommand{\thefigure}{S\arabic{figure}}  
\renewcommand{\theequation}{S\arabic{equation}} 

以下是测试例子【为了能在网页上显示,这里需要手动将\ref_1和\ref_2改为\ref后再编译运行】:

\documentclass{article}
\usepackage{graphicx}

% 加上以下语句,S字母可任意修改
\renewcommand{\thefigure}{S\arabic{figure}}  
\renewcommand{\theequation}{S\arabic{equation}} 

\begin{document}

Here are Eq. (\ref_1{eq:mass_energy_equivalence}) and Fig. \ref_2{fig:a}.

\begin{equation}
    E=mc^2 \label{eq:mass_energy_equivalence}
\end{equation}

\begin{figure}[htbp]
    % \includegraphics*[width=0.5\textwidth]{a.eps}
    \caption{This is a caption. Image is not shown.}
    \label{fig:a}
\end{figure}

\end{document}

运行结果:

267 次浏览

【说明:本站主要是个人的一些笔记和代码分享,内容可能会不定期修改。为了使全网显示的始终是最新版本,这里的文章未经同意请勿转载。引用请注明出处:https://www.guanjihuan.com

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Captcha Code