引用圖形時如何刪除「圖形」一詞?

引用圖形時如何刪除「圖形」一詞?

因此,我將我的圖標記為“圖部分.圖編號”,這意味著每個標題分別以“圖1.1”、“圖1.2”和“圖2.1”開頭(如果在第1 節和第2 節中)。我透過在序言中添加以下內容來實現這一目標:

\renewcommand{\thesubfigure}{圖 \arabic{section}.\arabic{subfigure}}

我使用子圖的原因是能夠在頁面上並排顯示圖。無論如何,當我在實際文本中引用這些數字時,例如“請參閱數字\ref{label1}和\ref{label2}”,實際輸出是“請參閱數字圖1.1和圖1.2”。

如何在標題中保留“圖”一詞,但在文本中引用該圖時隱藏它?

這是一個最小的工作範例:

\documentclass{article}

\usepackage{graphicx, caption}
\usepackage{float} %Needed for the [H] after \begin{figure}.  [H] stands for "Here", 
i.e., the figures appear in the PDF in the same location as in the TeX code.

\usepackage[labelformat=simple]{subcaption}

\renewcommand{\thesubfigure}{Figure \arabic{section}.\arabic{subfigure}}

\begin{document}
\section{First section}
\section{Second section}
    \begin{figure}[H]
    \centering
    \begin{subfigure}[t]{.45\textwidth}
    \begin{center} \includegraphics[scale=0.2]{stars.jpeg} \end{center}
    \caption{A picture of the past.}
    \label{fig:stars}
    \end{subfigure}
    ~~~
    \begin{subfigure}[t]{.45\textwidth}
    \begin{center} \includegraphics[scale=0.2]{monkeys.jpeg} \end{center}
    \caption{Humans not too long ago.}
    \label{fig:primates}
    \end{subfigure}
    ~~~
    \begin{subfigure}[t]{.42\textwidth}
    \begin{center} \includegraphics[scale=0.16]{lion.jpeg} \end{center}
    \caption{Not today Satan.}
    \label{fig:predator}
    \end{subfigure}
    ~~~
    \begin{subfigure}[t]{.42\textwidth}
    \begin{center} \includegraphics[scale=0.16]{blueberry.jpeg} \end{center}
    \caption{Is this a blueberry-topped cupcake, or just a cup of blueberries?.}
    \label{fig:enigma}
    \end{subfigure}
    ~~~
\end{figure}
As we can see in figures \subref{fig:stars} and \subref{fig:enigma}, I'm not very good at making a minimal working example.
\end{document}

這給出了輸出:

在此輸入影像描述

答案1

從評論看來,你根本不知道什麼子數字,而是類似的東西

在此輸入影像描述

\documentclass{article}

\renewcommand\thefigure{\thesection.\arabic{figure}}

\usepackage{graphicx}
\begin{document}

\section{Zzzzzz}

\begin{figure}[htp]
  \begin{minipage}[t]{.33\linewidth}
    \centering
     \includegraphics[width=.7\linewidth]{example-image-a}
     \caption{Zzzzz\label{zza}}
  \end{minipage}\hfill
  \begin{minipage}[t]{.33\linewidth}
    \centering
     \includegraphics[width=.7\linewidth]{example-image}
     \caption{Zzzzz zzz\label{zzb}}  
  \end{minipage}\hfill
  \begin{minipage}[t]{.33\linewidth}
        \centering
     \includegraphics[width=.7\linewidth]{example-image-b}
     \caption{Zzzzz zzzzzz\label{zzc}}
  \end{minipage}
\end{figure}

See figures \ref{zza} to \ref{zzc}
\end{document}

相關內容