在我的文档中,我使用了两列。然而,这使得在文本中制作(复杂)图形变得有点复杂。
我遇到的问题是使用子标题框会在文本中创建错误的引用。在提供的文件中我在图 1.3 中给出了一个例子(参考图 1.4)。
我想我明白它为什么会这样做。子标题框的标签想要附加到最后一个带标题的图形上。那是前一个图形,但是已经创建了一个新的图形环境。因此,Latex 将其解释为两个图形。为了避免这种情况,该图形的标题和标签应该位于子标题框之前,但这也意味着标题位于图形上方。
有没有办法强制将标题置于底部?或者用后来为整个图形环境制作的标题来标记子标题?
如果有任何不清楚的地方,请告诉我。我在此先行表示感谢。
代码开始:
\documentclass{tudelft-report}
\usepackage{pdfpages}
\usepackage{hyperref}
\usepackage{multicol}
\usepackage{multirow}
\usepackage[export]{adjustbox}
\usepackage{wrapfig}
\hyphenpenalty=100000
\usepackage{parskip}
\usepackage{pdflscape}
\usepackage{cuted}
\usepackage{pgfplots}
\pgfplotsset{width=\linewidth}
\usepackage{stanli}
\usepackage{blindtext}
\usepackage{float}
\usetikzlibrary{arrows.meta}
\usepackage{array}p}}
\setlength{\columnsep}{2.5em}
%%%%% Begin of document %%%%%
\begin{document}
\mainmatter
\chapter{Stack Exchange}
\begin{multicols}{2}
类中的包:
%% Main packages in the document
\RequirePackage{amsmath} % Mathematics
\RequirePackage{amssymb} % Symbols
\RequirePackage{siunitx} % Various functions, e.g. \num{}
\RequirePackage{tabularx} % Additional functions to tables
\RequirePackage{booktabs} % Adds more line functionality to tables
\RequirePackage{longtable} % Lets tables break over page
\RequirePackage{multirow} % Counterpart of multi columns
\RequirePackage{enumitem} % Customise the list spacing
\RequirePackage{geometry} % Document geometry
\RequirePackage{titlesec} % Custom titles
\RequirePackage{titletoc} % Custom table of contents
\RequirePackage{fancyhdr} % Custom header/footer
\RequirePackage[hidelinks]{hyperref} % Improved referencing/links
\RequirePackage{graphicx} % Adding images
\RequirePackage{float} % Additional float parameters
\RequirePackage[labelfont=bf,justification=centering,footnotesize]{caption} % Captions
\RequirePackage{subcaption} % Subfigures and subcaptions
\RequirePackage{xcolor} % Using colours in documents
\RequirePackage{tikz} % Create graphic elements
\RequirePackage[backend=bibtex,style=apa]{biblatex} % Manages bibliography
\RequirePackage{datetime} % Used in preface for monthname
\RequirePackage{microtype} % Refinements towards typographical perfection
\RequirePackage[nottoc]{tocbibind} % Add the lists to the table of contents
\RequirePackage{xspace} % Ensures correct spacing after macros like \deg
文档:
\begin{document}
\mainmatter
\chapter{Stack Exchange}
\begin{multicols}{2}
[Random text] figure \ref{fig:furnplot}. [Random text]
\begin{figure}[H]
\captionof{figure}{figure 1.1} \label{fig:furnplot}
\begin{tikzpicture}
\begin{axis}[axis lines = left,xlabel = x,ylabel = {y},xmin=0,xmax=5,ymin=0,ymax=0.5]
\addplot[domain=0.1:5.1,samples=100]{-x*(1-cosh(1/(2*x)))};
\end{axis}
\end{tikzpicture}
\end{figure}
[More text] A visual representation of these equations can be seen in figure \ref{fig:secfor}.
\begin{figure}[H]
\parbox{\columnwidth}{%
\captionof{figure}{figure 1.2} \label{fig:secfor}
\subcaptionbox{fig 1 2 a \label{sfig:secfora}}[\linewidth]{%
\begin{tikzpicture}
\pgfplotsset{width=\linewidth,yticklabel style={text width=2em,align=right}}
\begin{axis}[axis equal image,axis lines = left,xlabel = x, ylabel = y,xmin=-1.5,xmax=1.5,ymin=-1,ymax=0,y dir = reverse,max space between ticks=1000pt,try min ticks = 3]
\addplot[domain=-1.2:-0.6,samples=7,-latex]{1.05*(cosh(x/1.05)-cosh(2.4/(2*1.05))};
\addplot[domain=-0.6:1.2,samples=10, dotted]{1.05*(cosh(x/1.05)-cosh(2.4/(2*1.05))};
\end{axis}
\end{tikzpicture}
}%
\\
\subcaptionbox{fig 1 2 b \label{sfig:secforb}}[\linewidth]{%
\begin{tikzpicture}% q
\pgfplotsset{width=\linewidth,height=0.5\linewidth,yticklabel style={text width=2em,align=right}}
\begin{axis}[axis x line=top,axis y line=left,ylabel = y, xmin=-1.5,xmax=1.5,y dir = reverse]
\addplot[domain=-1.2:-0.6,samples=7]{0.34*sqrt(1+sinh(x/1.05)^2)};
\addplot[samples=7, domain=-1.2:-0.6, quiver={u={0},v={0.34*sqrt(1+sinh(x/1.05)^2)}},-latex](x,0);
\end{axis}
\end{tikzpicture}
}%
}%
\end{figure}
[more text] figure \ref{fig:triangle}. [more text] figure \ref{sfig:secfora}[text] figure \ref{sfig:trianglea}
\begin{figure}[H]
\parbox{\columnwidth}{%
\subcaptionbox{fig 1 3 a \label{sfig:trianglea}}[\linewidth]{%
\begin{tikzpicture}
\draw[Latex-] (0,0) -- (-1,-1/2) node[pos=0.5, xshift = -0.8em,yshift=0.8em]{1};
\draw[-Latex] (0,0) -- (1,-2) node[pos=0.5, right]{2};
\draw[dotted] (1,-2) -- (0,-2-1/2);
\draw[darkgray,-Latex] (0,0) -- (0,-2-1/2) node[pos=0.5, left]{3};
\end{tikzpicture}
}%
\\
\subcaptionbox{fig 1 3 b}[\linewidth]{%
\begin{tikzpicture}
\draw[-Latex] (0,0) -- (4,0) node[pos=0.5, above]{$1$};
\draw[-Latex] (4,0) -- (4,-2) node[pos=0.5, right]{\large $\frac{1}{2}$};
\draw[darkgray] (0,0) -- (4,-2) node[pos=0.5, below]{\large $\frac{1}{7}$};
\end{tikzpicture}
}%
}%
\captionof{figure}{figure 1.3} \label{fig:triangle}
\end{figure}
[text] (see the dotted line in figure \ref{sfig:secfora}) [more text] See figure \ref{fig:positions}.
\begin{figure}[H]
\captionof{figure}{figure 1.4} \label{fig:positions}
\hfill
\subcaptionbox{fig 1 4 b}[3.5cm]{%
\begin{tikzpicture}
\draw[rotate around={15:(0,0)}] (0,0)--(0,3);
\draw[rotate around={15:(0,0)},dashed] (-0.7,0)--(-0.7,3);
\draw[rotate around={15:(0,0)}] (0,0.3)--(-0.7,0.3);
\draw[rotate around={15:(0,0)}] (0,1.1)--(-0.7,1.1);
\fill[rotate around={15:(0,0)},pattern=north east lines] (0,0.3) rectangle ++(-0.7,0.8);
\draw[rotate around={15:(0,0)},|-|] (-0.9,0.3)--(-0.9,1.1) node[pos=1, above]{t};
\draw[rotate around={15:(0,0)},|-|] (-1.3,0.3)--(-1.3,1.1) node[pos=1, above,xshift=-0.5em]{$h(s)$};
\draw[rotate around={15:(0,0)}] (0.2,0.3)--(0.3,0.3) node[pos=1.0, right]{$\sigma_0(s)$};
\draw[rotate around={15:(0,0)}] (0.2,1.1)--(0.3,1.1) node[pos=1.0, right]{$\sigma_1(s)$};
\draw[rotate around={15:(0,0)}] (0.2,1.9)--(0.3,1.9) node[pos=1.0, right]{$\sigma_2(s)$};
\draw[rotate around={15:(0,0)}] (0.2,2.3)--(0.3,2.3) node[pos=1.0, right]{$\tau_2(s)$};
\end{tikzpicture}
}%
\end{figure}
\end{multicols}
\end{document}
答案1
答案在这里:\captionof{figure} 以数字 2 开头
\begin{document}
\mainmatter
\chapter{Stack Exchange}
\begin{multicols}{2}
[More text] A visual representation of these equations can be seen in figure \ref{fig:secfor}.
\begin{figure}[H]
\centering
\begin{subfigure}{\linewidth}
\begin{tikzpicture}
\pgfplotsset{width=\linewidth,yticklabel style={text width=2em,align=right}}
\begin{axis}[axis equal image,axis lines = left,xlabel = x, ylabel = y,xmin=-1.5,xmax=1.5,ymin=-1,ymax=0,y dir = reverse,max space between ticks=1000pt,try min ticks = 3]
\addplot[domain=-1.2:-0.6,samples=7,-latex]{1.05*(cosh(x/1.05)-cosh(2.4/(2*1.05))};
\addplot[domain=-0.6:1.2,samples=10, dotted]{1.05*(cosh(x/1.05)-cosh(2.4/(2*1.05))};
\end{axis}
\end{tikzpicture}
\caption{fig 1 2 a} \label{sfig:secfora}
\end{subfigure}
\\
\begin{subfigure}{\linewidth}
\begin{tikzpicture}
\pgfplotsset{width=\linewidth,height=0.5\linewidth,yticklabel style={text width=2em,align=right}}
\begin{axis}[axis x line=top,axis y line=left,ylabel = y, xmin=-1.5,xmax=1.5,y dir = reverse]
\addplot[domain=-1.2:-0.6,samples=7]{0.34*sqrt(1+sinh(x/1.05)^2)};
\addplot[samples=7, domain=-1.2:-0.6, quiver={u={0},v={0.34*sqrt(1+sinh(x/1.05)^2)}},-latex](x,0);
\end{axis}
\end{tikzpicture}
\caption{fig 1 2 b} \label{sfig:secforb} \end{subfigure}
\addtocounter{figure}{-1}
\captionof{figure}{figure 1.2} \label{fig:secfor}
\end{figure}
[更多文本] 图 ref{fig:triangle}。[更多文本] 图 \ref{sfig:secfora}[文本] 图 ref{sfig:trianglea}
\end{多列} \end{文档}