我在使用adjustbox时遇到了困难。我创建了一个子部分,里面有一个表格,这个表格移动到另一个子部分,我不知道如何解决这个问题。希望您能帮助我:
使用
\documentclass[14pt,a4paper]{extarticle}
子节示例
\subsection{Operacionalización de Variables}
\begin{quote}
\begin{table}[]
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{|l|l|c|l|c|}
\hline
\textbf{Variable} & \textbf{Dimension} & \multicolumn{1}{l|}{\textbf{Indicador}} & \textbf{Sub Indicador} & \multicolumn{1}{l|}{\textbf{Escala de Medición}} \\ \hline
\multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}Factores \\ Demográficos\end{tabular}} & Sexo & \begin{tabular}[c]{@{}c@{}}Hombre \\ Mujer\end{tabular} & & Nominal \\ \cline{2-5}
& Lugar de residencia & \begin{tabular}[c]{@{}c@{}}zona urbana \\ zona urbana marginal\\ zona marginal\end{tabular} & & Nominal \\ \hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Factores \\ Economicos\end{tabular}} & \multicolumn{1}{c|}{Condición económica} & Ingresos & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}\textless{}1000\\ 1001 -1200\\ 1200 -1300\\ 1300 -1600\\ \textgreater{}1600\end{tabular}} & Ordinal \\ \hline
\end{tabular}
\end{adjustbox}
\end{table}
\end{quote}
答案1
你也可以看看 needspace 包。这比解释起来更容易。
\documentclass[14pt,a4paper]{extarticle}
\usepackage{multirow}
\usepackage{adjustbox}
\usepackage{needspace}
\newsavebox{\tempbox}% just in case
\begin{document}
\setcounter{section}{2}
\setcounter{subsection}{8}
\rule{1pt}{25\baselineskip}% threshold for new page
\setbox\tempbox=\vbox{%
\subsection{Operacionalización de Variables}
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}[b]{|l|l|c|l|c|}
\hline
\textbf{Variable} & \textbf{Dimension} & \multicolumn{1}{l|}{\textbf{Indicador}} & \textbf{Sub Indicador} & \multicolumn{1}{l|}{\textbf{Escala de Medición}} \\ \hline
\multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}Factores \\ Demográficos\end{tabular}} & Sexo & \begin{tabular}[c]{@{}c@{}}Hombre \\ Mujer\end{tabular} & & Nominal \\ \cline{2-5}
& Lugar de residencia & \begin{tabular}[c]{@{}c@{}}zona urbana \\ zona urbana marginal\\ zona marginal\end{tabular} & & Nominal \\ \hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Factores \\ Economicos\end{tabular}} & \multicolumn{1}{c|}{Condición económica} & Ingresos & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}\textless{}1000\\ 1001 -1200\\ 1200 -1300\\ 1300 -1600\\ \textgreater{}1600\end{tabular}} & Ordinal \\ \hline
\end{tabular}
\end{adjustbox}}
\needspace{\ht\tempbox}\unvbox\tempbox
\end{document}
答案2
您的表格(即tabular
)被包裹在一个table
所谓的“浮动”环境中,即它浮动在文本中并放置在合适的位置,通常是在页面边界上。有多种方法可以更改此设置(例如,请参阅如何影响 LaTeX 中图形和表格等浮动环境的位置?) 但对于您来说,强制使用非浮动表格可能更好。该adjustbox
软件包可以帮助您,只需使用键即可nofloat=table
。如果您需要额外的垂直空间(作为环境的替代quote
),那么也请添加vspace=<amount>
键。
\documentclass[14pt,a4paper]{extarticle}
\usepackage{adjustbox}
\usepackage{blindtext}
\usepackage{multirow}
\begin{document}
\blindtext
\subsection{Operacionalización de Variables}
\begin{adjustbox}{max width=\textwidth,nofloat=table,vspace=\medskipamount}
\begin{tabular}{|l|l|c|l|c|}
\hline
\textbf{Variable} & \textbf{Dimension} & \multicolumn{1}{l|}{\textbf{Indicador}} & \textbf{Sub Indicador} & \multicolumn{1}{l|}{\textbf{Escala de Medición}} \\ \hline
\multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}Factores \\ Demográficos\end{tabular}} & Sexo & \begin{tabular}[c]{@{}c@{}}Hombre \\ Mujer\end{tabular} & & Nominal \\ \cline{2-5}
& Lugar de residencia & \begin{tabular}[c]{@{}c@{}}zona urbana \\ zona urbana marginal\\ zona marginal\end{tabular} & & Nominal \\ \hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Factores \\ Economicos\end{tabular}} & \multicolumn{1}{c|}{Condición económica} & Ingresos & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}\textless{}1000\\ 1001 -1200\\ 1200 -1300\\ 1300 -1600\\ \textgreater{}1600\end{tabular}} & Ordinal \\ \hline
\end{tabular}
\end{adjustbox}
\blindtext
\end{document}