gpt4 book ai didi

latex - 垂直对齐表格单元格中的数字?

转载 作者:行者123 更新时间:2023-12-04 04:36:12 25 4
gpt4 key购买 nike

我正在尝试在 LaTeX 中设计一个有 7 行和 4 列的有点复杂的表格(sidewaystable)。该表格包含文本、bibtex 引文以及单元格中最重要的数字(目前这些数字是 jpeg 用于测试目的,最终我想将它们更改为 PDF)。这些数字被非常紧密地裁剪(故意)。

我有我想要的大部分表格布局,但数字在单元格的顶部对齐!这看起来很难看,我需要在它们的单元格内垂直和水平对齐它们。

我尝试了几件事(parbox,为数组包手动定义一个新的列类型......)但根本不知道如何去做。

这是我的表的 latex 源代码的基本外观(文本替换为模型文本):

    % THE TABLE
\begin{sidewaystable}\footnotesize
\begin{tabular}{| p{3cm} | c | p{6cm} | p{4cm} |}
\hline
column1description & column2description & TypeOfOrganism & column4description\\ \hline
\hline
Diagram1title & \includegraphics[scale=0.25]{vector_figures/mockup_001.jpg} & description1 & {\em S.\ cerevisiae, E.\ coli}\\ \hline
Diagram2title & \includegraphics[scale=0.25]{vector_figures/mockup_002.jpg} & description2 & {\em S.\ cerevisiae, E.\ coli}\\ \hline
Diagram3title & \includegraphics[scale=0.25]{vector_figures/mockup_003.jpg} & description3 & {\em S.\ cerevisiae, E.\ coli}\\ \hline
Diagram4title & \includegraphics[scale=0.25]{vector_figures/mockup_004.jpg} & description4 & {\em S.\ cerevisiae}\\ \hline
Diagram5title & \includegraphics[scale=0.25]{vector_figures/mockup_005.jpg} & description5 & {\em S.\ cerevisiae}\\ \hline
Diagram6title & \includegraphics[scale=0.25]{vector_figures/mockup_006.jpg} & description6 & {\em S.\ cerevisiae}\\ \hline

\end{tabular}

\caption[Diagrams and their descriptions]{\textbf{ Diagrams and their descriptions} Some diagrams with interesting descriptions}\label{tab:table2}.

\end{sidewaystable}

如果有人能给我一些关于如何在单元格内垂直和水平对齐数字的信息,我将非常感激。

IE。图形需要在每个单元格中,以便图形上方和下方到相应单元格边框的空间以及左右到相应单元格边框的空间是相同的。

(我找到了几页关于这个或相关表格布局问题的页面,但无法理解实际要做什么。)

最佳答案

您可以使用 tabularx包(或 array 包)使所有单元格垂直对齐。这可以让你开始:

\usepackage{tabularx}
\begin{document}

\renewcommand{\tabularxcolumn}[1]{>{\arraybackslash}m{#1}}
\begin{tabularx}{\textwidth}{XXXX}
\hline
column1description & column2description & TypeOfOrganism & column4description\\ \hline
\hline
Diagram1title & the graphics & I would be very thankful if someone
could give me some information on how to align the figures vertically
as well as horizontally within their cells.I would be very thankful if someone could give me some information on how to align the figures vertically as well as horizontally within their cells. & {\em S.\ cerevisiae, E.\ coli}\\
\hline\\
Diagram1title & the graphics & I would be very thankful if someone
could give me some information on how to align the figures vertically
as well as horizontally within their cells.I would be very thankful if
someone could give me some information on how to align the figures
vertically as well as horizontally within their cells. & {\em S.\
cerevisiae, E.\ coli}\\
\hline
\end{tabularx}

\end{document}

关于latex - 垂直对齐表格单元格中的数字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2378925/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com