![对齐表格并围绕表格换行](https://linux22.com/image/319264/%E5%AF%B9%E9%BD%90%E8%A1%A8%E6%A0%BC%E5%B9%B6%E5%9B%B4%E7%BB%95%E8%A1%A8%E6%A0%BC%E6%8D%A2%E8%A1%8C.png)
我正在尝试做一些我不确定我能做到的事情。所以,让我解释一下。我有一个enumerate
环境。里面有一个数组,里面有 5 个图像,然后是一个表格。
我想在该表的右侧写入文本,直到到达表的末尾,然后继续下一行,但我得到的是:
编辑1
Werner 问我是否可以发布我使用 wraptable 的尝试,因此这里是:
\begin{wraptable}{r}{5.5cm}
\begin{tabular}{|l|l|l|}
\hline
\multicolumn{3}{|c|}{\textbf{Coeficiente de Curtosis}} \\ \hline
& \textbf{sexo=0} & \textbf{sexo=1} \\ \hline
\textbf{Peso} & 4,37531 & 1,21824 \\ \hline
\textbf{Altura} & -0,97849 & 0,946925 \\ \hline
\textbf{Zapato} & -0,28973 & -0,620593 \\ \hline
\textbf{Dinero} & 6,88646 & 2,99526 \\ \hline
\textbf{Tiempo} & -0,497143 & 0,106985 \\ \hline
\end{tabular}
\end{wraptable}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
编辑 2:Bernard 要求的示例的所有文件 -LaTeX 文件
我想要这个,但是右侧全是文本。我尝试使用 \begin{wraptable},但是不起作用。你能帮助我吗?
提前谢谢您!干杯!
答案1
这是一个基于纯文本宏集的解决方案insbox
。我\InsertListR
根据原始\InsertBoxR
命令定义了命令。它需要 $2$ 个参数:插入框之前未触及的行数和插入的内容。如果无法很好地计算所需的较短行数,则可以使用可选参数:补充较短行数。您不能使用此代码添加标题。
我借此机会简化了其余代码并改进了您的表格,加载了siunitx
用于单元格中数字垂直对齐的包,并对cellspace
行进行了一些垂直填充。
\documentclass[10pt,a4paper,final]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{mathtools,stackengine,amsfonts,amssymb,graphicx,wrapfig}
\usepackage{siunitx}
\sisetup{output-decimal-marker={,}}
\usepackage{cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}
\addparagraphcolumntypes{S}
% # START ## Márgenes #
\usepackage{geometry}
\geometry{
a4paper,
height=24cm, % height of the text block
width=17cm, % width of the text block
top=3cm, % distance of the text block from the top of the page
headheight=1.7cm, % height for the header block
headsep=1.5cm, % distance from the header block to the text block1
footskip=1cm,
}
% # END ## Márgenes #
% # START # Paquete para añadir imágenes
% Centrar imagen
%\begin{figure}[h]
%\includegraphics[scale=0.5]{logo-uc3m2}
%\centering
%\end{figure}
% # END # Paquete para añadir imágenes
% # START ## Fuente #
\usepackage{mathpazo,euler}
\linespread{1.00}
% # END ## Fuente #
% # START ## Quitar sangría inicial #
% Poner \indent para indentar.
% Poner \noindent para quitar indentación.
\newlength\tindent
\setlength{\tindent}{\parindent}
\setlength{\parindent}{0pt}
\renewcommand{\indent}{\hspace*{\tindent}}
% # END ## Quitar sangría inicial #
\input{insbox}
\makeatletter
\@InsertBoxMargin = 12pt
\makeatother
\geometry{showframe, nomarginpar}
\usepackage{etoolbox}
\newcommand*{\wrapitem}{\pretocmd{\labelenumi}{\hskip\leftmargin}{}{}\item\apptocmd{\labelenumi}{\hskip-\leftmargin}{}{}}
%
\newcommand{\InsertListL}[3][]{%
\setlength{\leftskip}{\leftmargin}\mbox{}\vspace*{-\baselineskip}%
\InsertBoxL{#2}{#3}[#1]\par \hspace{\itemindent}
}%
\newcommand{\InsertListR}[3][]{%
\par\mbox{}\vspace*{-\baselineskip}\setlength{\leftskip}{\leftmargin}%
\InsertBoxR{#2}{\hskip-\leftmargin#3\hskip\leftmargin}[#1]
}%
\begin{document}
\begin{enumerate}
\item Algunas de las variables de este fichero presenta bimodalidad debido a diferencias entre chicos y chicas. Utilizando los histogramas y el coeficiente de curtosis, indica en qué variable es más acusada esta bimodalidad (compara sólo las variables peso, altura, zapato, dinero (que llevan en el bolsillo) y tiempo (que tardan en llegar a la universidad)). Justifica la respuesta.
\begin{figure}[hp]
\centering
\begin{tabular}{cc}
\includegraphics[width=2.85in]{DATA/histogram_peso-sexo_3-4}
\includegraphics[width=2.85in]{DATA/histogram_altura-sexo_3-4} & \\[2ex]
\includegraphics[width=2.85in]{DATA/histogram_zapato-sexo_3-4.png}
\includegraphics[width=2.85in]{DATA/histogram_dinero-sexo_3-4} & \\[2ex]
\includegraphics[width=2.85in]{DATA/histogram_tiempo-sexo_3-4}
\end{tabular}
\end{figure}%
\InsertListR[4]{0}{
\begin{tabular}{|Cl|*{2}{S[table-format =-1.6]|}}
\hline
\multicolumn{3}{|Cc|}{\textbf{Coeficiente de Curtosis}} \\ \hline
& {\textbf{sexo=0}} & {\textbf{sexo=1}} \\ \hline
\textbf{Peso} & 4,37531 & 1,21824 \\ \hline
\textbf{Altura} & -0,97849 & 0,946925 \\ \hline
\textbf{Zapato} & -0,28973 & -0,620593 \\ \hline
\textbf{Dinero} & 6,88646 & 2,99526 \\ \hline
\textbf{Tiempo} & -0,497143 & 0,106985 \\ \hline
\end{tabular}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{enumerate}
\end{document}