LaTeX:不管源代码的主要块在哪里,是否可以将图像/表放在靠近引用它们的位置?
我想知道,不管这些图像/表格的源代码的主要块在哪里,是否可以将图像/表格放在它们被引用的位置附近(它们对应的LaTeX:不管源代码的主要块在哪里,是否可以将图像/表放在靠近引用它们的位置?,latex,Latex,我想知道,不管这些图像/表格的源代码的主要块在哪里,是否可以将图像/表格放在它们被引用的位置附近(它们对应的\ref{images/tables}?例如,我想将下面提到的表放在与出现\ref{table:1}的页面相同的页面中,但下面的代码位于文档的末尾,就在\end{document}之前 \begin{table}[h!] \centering \begin{tabular}{||c c c c||} \hline Col1 & Col2 & Col2 & C
\ref{images/tables}
?例如,我想将下面提到的表放在与出现\ref{table:1}
的页面相同的页面中,但下面的代码位于文档的末尾,就在\end{document}
之前
\begin{table}[h!]
\centering
\begin{tabular}{||c c c c||}
\hline
Col1 & Col2 & Col2 & Col3 \\ [0.5ex]
\hline\hline
1 & 6 & 87837 & 787 \\
2 & 7 & 78 & 5415 \\
3 & 545 & 778 & 7507 \\
4 & 545 & 18744 & 7560 \\
5 & 88 & 788 & 6344 \\ [1ex]
\hline
\end{tabular}
\caption{Table to test captions and labels}
\label{table:1}
\end{table}
通常,最好将源放在第一次引用浮点的位置。但是,如果要在单个位置收集源(例如外部文件或前言),可以执行以下操作:
\documentclass{article}
\usepackage{duckuments}
\newcommand{\taba}{%
\begin{table}[htbp]
\centering
\begin{tabular}{||c c c c||}
\hline
Col1 & Col2 & Col2 & Col3 \\ [0.5ex]
\hline\hline
1 & 6 & 87837 & 787 \\
2 & 7 & 78 & 5415 \\
3 & 545 & 778 & 7507 \\
4 & 545 & 18744 & 7560 \\
5 & 88 & 788 & 6344 \\ [1ex]
\hline
\end{tabular}
\caption{Table to test captions and labels}
\label{table:1}
\end{table}
}%
\begin{document}
\duckument
test \ref{table:1}\taba test
\duckument
\end{document}
(请不要使用h!
作为浮动说明符。如果有任何问题,这将导致浮动的位置不理想。让TeX尽其所能:找到浮动的最佳位置)