
所以我試著放入邊際資料以及中心資料。對於利潤率數字,我想做這樣的事情:
但對於中心圖,我希望標題標籤如下所示,其中數字來自章節,圖號更新為 1。
對於每一個,我都嘗試過創建它,但它只能成為其中之一。如果我同時嘗試這兩種方法,則會出現序言錯誤。我究竟做錯了什麼?請告訴我。 MWE如下:
\documentclass[graybox,envcountchap,sectrefs,12pt]{svmono}
\usepackage[utf8]{inputenc}
\usepackage[labelfont=bf,sf,font=small,figurewithin=chapter]{caption}
\captionsetup{labelformat=empty,skip=1pt,font={bf,sf}}
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\begin{document}
\chapter{Introduction to Chemistry Laboratory}
\marginpar{
\centering
\includegraphics[width=2cm,height=2.75cm]{Beaker.png}
\captionof{figure}{Beaker}
}
\begin{figure}
\centering
\begin{tikzpicture}
\foreach \x in {0,1,...,2}{
\draw (\x,0) -- (\x,-0.2)node[below,scale=0.4]{\x};
}
\foreach \x in {0.1,0.2,...,1.9}{
\draw (\x,0) -- (\x,-0.075);
}
\foreach \x in {0.5,1,...,1.5}{
\draw (\x,0) -- (\x,-0.15);
};
\draw (0,0)--(2,0);
\draw[fill=lightgray] (0,0.05) rectangle (1.625,0.45);
\end{tikzpicture}
\captionsetup{labelsep=period,labelformat={simple}}
\caption{This}\label{fig:1}
\end{figure}
\end{document}
答案1
將我上述的評論總結為答案:
要將文本添加到圖像的頁邊距中,只需在其中鍵入一些文本,而無需使用\captionof
。如果你想對所有文字應用統一的樣式,你可以定義你自己的命令,就像我在下面的 MWE 中所做的那樣。
要使用章節號.圖號對其他圖進行編號,只需刪除\counterwithout{chapter}{figure}
和\usepackage{chngcntr}
。班級svmono
預設對每章的圖形、表格和方程式進行編號。
在下面的 MWE 中,我還刪除了與該caption
套件相關的所有內容。由於您使用的文件類是由出版商提供的,因此如果您想與他們一起發布,您可能必須堅持他們的設計選擇。
我還刪除了,graybox
因為這不是有效的類別選項,並且會拋出相應的警告。
最後,我建議指定圖像的寬度或高度,以避免圖像扭曲。
\documentclass[envcountchap,sectrefs,12pt]{svmono}
\usepackage[utf8]{inputenc}
%\usepackage[labelfont=bf,sf,font=small,figurewithin=chapter]{caption}
%\captionsetup{labelformat=empty,skip=1pt,font={bf,sf}}
\usepackage[demo]{graphicx} % Remove demo option in actual document.
\usepackage{tikz}
\newcommand{\unnumberedcaption}[1]{\bfseries \sffamily #1}
\begin{document}
\chapter{Introduction to Chemistry Laboratory}
\marginpar{
\centering
\includegraphics[width=2cm,height=2.75cm]{Beaker.png}
\unnumberedcaption{Beaker}
}
\begin{figure}
\centering
\begin{tikzpicture}
\foreach \x in {0,1,...,2}{
\draw (\x,0) -- (\x,-0.2)node[below,scale=0.4]{\x};
}
\foreach \x in {0.1,0.2,...,1.9}{
\draw (\x,0) -- (\x,-0.075);
}
\foreach \x in {0.5,1,...,1.5}{
\draw (\x,0) -- (\x,-0.15);
};
\draw (0,0)--(2,0);
\draw[fill=lightgray] (0,0.05) rectangle (1.625,0.45);
\end{tikzpicture}
%\captionsetup{labelsep=period,labelformat={simple}}
\caption{This}\label{fig:1}
\end{figure}
\end{document}