只需为绘画创建一个新的环境。

只需为绘画创建一个新的环境。
\renewcommand{\figurename}{Paint }
\begin{figure}[h]
    \includegraphics{22.png}
    \label{fig:22}
\end{figure}

This is example reference \autoref{fig:22}

它写

This is example reference Figure 1

反而

This is example reference Paint 1.

我应该怎么做才能获得 Paint 1?

答案1

只需为绘画创建一个新的环境。

创造自己的新环境比修改图形要容易得多。结合来自这里这里您可以轻松地为绘画创建一个新的环境,其行为就像人物一样,但是是为特定目的而构建的:

输出

在此处输入图片描述

平均能量损失

\documentclass[10pt,a4paper]{article}
\usepackage{newfloat}
\usepackage{hyperref}
\usepackage{cleveref}


\DeclareFloatingEnvironment[
fileext=lop,
listname={List of Paintings},
name=Painting,
placement=tbhp,
within=section,
]{painting}

\crefname{painting}{painting}{paintings}
\Crefname{painting}{Painting}{Paintings}


\begin{document}
\begin{painting}
\centering
Some painting should go here.
\caption{Something about the painting.}
\label{painting}
\end{painting}

You could use \texttt{autoref} to reference \autoref{painting}, but likely \texttt{cref} would be better to refer to \cref{painting} as either \Cref{painting} or \cref{painting}.
\end{document}

答案2

如果您的所有figure环境都应该标记为“Paint”(但您应该检查语法),那么您只需这样做即可hyperref

然而你需要标题或将指\label代某些随机事物。

\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref}

\renewcommand{\figurename}{Paint} % is it right?
\renewcommand{\figureautorefname}{Paint}

\begin{document}

\begin{figure}[htp]
\centering

\includegraphics[width=2cm]{example-image}

\caption{A caption}\label{fig:22}
\end{figure}

This is example reference \autoref{fig:22}

\end{document}

在此处输入图片描述

cleveref

\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[nameinlink]{cleveref}

\renewcommand{\figurename}{Paint} % is it right?
\crefname{figure}{Paint}{Paints}

\begin{document}

\begin{figure}[htp]
\centering

\includegraphics[width=2cm]{example-image}

\caption{A caption}\label{fig:22}
\end{figure}

This is example reference \cref{fig:22}

\end{document}

相关内容