在圖參考中加入括號

在圖參考中加入括號

幾乎不使用任何軟體包,當使用時\ref{label of figure}我只得到數字的編號。有沒有一種簡單的方法可以將其設定為在該數字周圍添加括號?目前我必須手動完成,但如果可以自動完成會更好

答案1

您可以使用\p@figure用於建立目前標籤的巨集。

\documentclass{article}
\makeatletter
\renewcommand\p@figure{\expandafter\counter@parenthesize}
\newcommand\counter@parenthesize[1]{(#1)}
\makeatother

\begin{document}

\begin{figure}
\caption{X}\label{X}
\end{figure}

See Figure~\ref{X}.

\end{document}

在此輸入影像描述

您可以對需要以類似方式處理的其他計數器執行類似操作。

相關內容