我的页面以图片开始,然后是一些文本,之后我创建了一个表格。但构建后,表格位于图片前面。在页面的开头...
\newpage
\begin{figure}[ht]
\centering
\includegraphics[scale=0.8]{./supply}
\caption{Some Caption}
\end{figure}
Text....
Text....
Text....
\begin{table}
\centering
\begin{tabular}{|l|l|}
\hline
Pin & Beschreibung \\ \hline
Conn2.1 & Positive Versorgungsspannung\\ \hline
Conn2.2 & Ground\\ \hline
Conn2.3 & Negative Versorgungsspannung\\
\hline
\end{tabular}
\caption{other caption}
\end{table}
\newpage
答案1
让我阐明一下我的评论...如果您不指定浮动的位置(figure
,table
),它们将浮动到页面的顶部,因此您的情况只需要为表格指定定位:
\documentclass{article}
\usepackage{graphicx}
\usepackage{lipsum} % for dummy text
\begin{document}
\begin{figure}[ht] % <---
\centering
\includegraphics[scale=0.8]{example-image-duck}%{./supply}
\caption{Some Caption}
\end{figure}
\lipsum[1]
\begin{table}[htb] % <---
\centering
\begin{tabular}{|l|l|}
\hline
Pin & Beschreibung \\ \hline
Conn2.1 & Positive Versorgungsspannung\\ \hline
Conn2.2 & Ground\\ \hline
Conn2.3 & Negative Versorgungsspannung\\
\hline
\end{tabular}
\caption{other caption}
\end{table}
\end{document}
有关浮动定位和(位置)说明符的含义的详细信息,请参见h
(此处)、t
(顶部)、b
(底部)p
(页面);请参阅 Frank Mittelbach 答案中的全面描述浮动定位。顺便说一句,建议您与或等h
配对使用,否则浮动将被推到文档末尾,如果在插入后的页面上没有足够的空间供其放置。t
b
答案2
\documentclass{article}
\usepackage{titlesec}
%1inch=25,4mm
%\titlelabel{{\hspace*{1cm}\makebox[1cm][l]{\thetitle}}}
%\usepackage{indentfirst}
\usepackage{lipsum}
\usepackage{showframe}
\usepackage[demo]{graphicx}
\begin{document}
\newpage
\begin{figure}[]
\centering
\includegraphics[scale=0.8]{./supply}
\caption{Some Caption}
\end{figure}
Text....
Text....
Text....
\begin{table}
\centering
\begin{tabular}{|l|l|}
\hline
Pin & Beschreibung \\ \hline
Conn2.1 & Positive Versorgungsspannung\\ \hline
Conn2.2 & Ground\\ \hline
Conn2.3 & Negative Versorgungsspannung\\
\hline
\end{tabular}
\caption{other caption}
\end{table}
\newpage
\end{document}
编辑
\documentclass{article}
\usepackage{titlesec}
%1inch=25,4mm
%\titlelabel{{\hspace*{1cm}\makebox[1cm][l]{\thetitle}}}
%\usepackage{indentfirst}
\usepackage{lipsum}
\usepackage{showframe}
\usepackage[demo]{graphicx}
\begin{document}
\newpage
\begin{figure}[]
\centering
\includegraphics[scale=0.8]{./supply}
\caption{Some Caption}
\end{figure}
Text....
Text....
Text....
\begin{table}[htbp]
\centering
\begin{tabular}{|l|l|}
\hline
Pin & Beschreibung \\ \hline
Conn2.1 & Positive Versorgungsspannung\\ \hline
Conn2.2 & Ground\\ \hline
Conn2.3 & Negative Versorgungsspannung\\
\hline
\end{tabular}
\caption{other caption}
\end{table}
\newpage
\end{document}