我想知道为什么在包装表中添加表格后,LaTeX 不会恢复到完整文本宽度?
我遇到此问题的实际代码在这里:http://pastebin.com/CRjHMZdT
我原本以为,表格呈现到页面右侧后,后面的文本能够横跨整个页面宽度。但实际情况是这样的:
((在下一页中,文本再次设置为整个宽度。))* 我使用以下方法进行编译
latex "${FILE}.tex"
dvips -Ppdf -o "${FILE}-pics.ps" "${FILE}.dvi"
ps2pdf -dAutoRotatePages=/None "${FILE}-pics.ps" "${FILE}-pics.pdf"
pdflatex "${FILE}.tex"
编辑好的,这是不正确的,在接下来的页面上,文本也不能占据整个文本宽度。
编辑2 好的,我尝试从原始代码中创建 MWE,它显示了相同的问题。此代码现在显示了相同的问题(还有另一个问题,似乎确实出了问题)
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{wrapfig}
\begin{document}
\begin{wraptable}{r}{5cm}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
$i$ & $NW_{i1}$ & $NW_{i2}$ & $NW_{i3}$ \\\hline\hline
0 & 0 & 0 & 0 \\\hline
1 & 0 & 0 & 1 \\\hline
\end{tabular}
\caption{Some table}
\end{wraptable}
\section*{A section}
\subsection*{subsections are nice}
Some text.
\begin{wraptable}{l}{5cm}
\centering
\begin{tabular}{|c|c|}
\hline
$NW_i$ & $CW_i$ \\\hline\hline
000 & 00000 \\\hline
001 & 10111 \\\hline
010 & 10010 \\\hline
011 & 00101 \\\hline
100 & 01100 \\\hline
101 & 11011 \\\hline
110 & 11110 \\\hline
111 & 01001 \\\hline
\end{tabular}
\caption{table two}
\end{wraptable}
\subsection*{the next subsection}
text.
\begin{wraptable}{r}{8cm}
\centering
%\renewcommand\arraystretch{1.3}% (MyValue=1.0 is for standard spacing)
\begin{tabular}{|c|c|}
\hline
$w$ & $A(w)$ \\\hline\hline
0 & $\frac{0}{8}$ \\\hline
1 & $\frac{4}{8}$ \\\hline
\end{tabular}
\caption{table 3}
\end{wraptable}
\subsection*{another subsection}
even more text.
\subsection*{yeah}
i want more more more more more more more more more more more more more more
more more more more more more more more more more more more more more more more
more and even more more more more more more more more more more more more more
more more more text.
\section*{another section in the wall}
text
\subsection*{yeah}
i want more more more more more more more more more more more more more more
more more more more more more more more more more more more more more more more
more and even more more more more more more more more more more more more more
more more more text.
\end{document}
(顺便说一句,在这里粘贴代码并不好玩)
如果我改变表格的顺序,这并没有关系,例如,将第二个表格移动到第三个表格的位置,并且将第三个表格移动到前第二个表格的位置,则不会改变任何东西。
编辑3 好的,也可以将示例简化(删除数学模式、babel 包、居中、标题)。使用 pdflatex 和 latex 进行编译也会产生相同的结果。这里有什么问题?
编辑4 不使用星号版本的部分和子部分“解决”了这个问题。我不认为这是一个功能,对我来说这更像是一个错误?
答案1
wrapfigure/wraptable
内部section*
也可以使用。但请注意wrapfig
手册 中的以下内容:
因此您应该在环境下方添加足够的文本wraptable
。
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{wrapfig,lipsum}
\begin{document}
\begin{wraptable}{r}{5cm}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
$i$ & $NW_{i1}$ & $NW_{i2}$ & $NW_{i3}$ \\\hline\hline
0 & 0 & 0 & 0 \\\hline
1 & 0 & 0 & 1 \\\hline
\end{tabular}
\caption{Some table}
\end{wraptable}
\lipsum[4-5]
\section*{A section}
\subsection*{subsections are nice}
Some text.
\begin{wraptable}[13]{r}{5cm}
\centering
\begin{tabular}{|c|c|}
\hline
$NW_i$ & $CW_i$ \\\hline\hline
000 & 00000 \\\hline
001 & 10111 \\\hline
010 & 10010 \\\hline
011 & 00101 \\\hline
100 & 01100 \\\hline
101 & 11011 \\\hline
110 & 11110 \\\hline
111 & 01001 \\\hline
\end{tabular}
\caption{table two}
\end{wraptable}
\lipsum[1-2]
\subsection*{the next subsection}
text.
\begin{wraptable}[7]{r}{8cm}
\centering
%\renewcommand\arraystretch{1.3}% (MyValue=1.0 is for standard spacing)
\begin{tabular}{|c|c|}
\hline
$w$ & $A(w)$ \\\hline\hline
0 & $\frac{0}{8}$ \\\hline
1 & $\frac{4}{8}$ \\\hline
\end{tabular}
\caption{table 3}
\end{wraptable}
\lipsum[3-4]
\subsection*{another subsection}
even more text.
\subsection*{yeah}
i want more more more more more more more more more more more more more more
more more more more more more more more more more more more more more more more
more and even more more more more more more more more more more more more more
more more more text.
\section*{another section in the wall}
text
\subsection*{yeah}
i want more more more more more more more more more more more more more more
more more more more more more more more more more more more more more more more
more and even more more more more more more more more more more more more more
more more more text.
\end{document}
请阅读手册的前三页the wrapfig
。