如何将页面分成 6 个部分?

如何将页面分成 6 个部分?

如何将一页分成 6 个部分?我想以 3x2 的布局放置 1 个表格和 5 个图形。迷你页面是否有必要,或者有更有效的方法吗?非常感谢。

\documentclass[landscape,11pt,a4paper]{report}
\usepackage{geometry}
 \geometry{
 a4paper,
 total={275mm,190mm},
 left=10mm,
 top=10mm,
 }
\usepackage{enumitem}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{xcolor,colortbl}
\pagenumbering{gobble}

\begin{document}


\begin{table}
\begin{tabular}{cc}
\hline\hline\noalign{\smallskip}
Time interval    &  s     \\
45               & g      \\
\noalign{\smallskip}\hline\noalign{\smallskip}
\end{tabular}
\end{table}

\begin{figure}[h]
\begin{center}
\includegraphics[width=0.25\textwidth]{fig1.png}
\includegraphics[width=0.25\textwidth]{fig2.png}
\end{center}
\end{figure}


\begin{figure}
\begin{center}
\includegraphics[width=0.25\textwidth]{fig3.png}
\includegraphics[width=0.25\textwidth]{fig4.png}
\includegraphics[width=0.25\textwidth]{fig5.png}
\end{center}
\end{figure}

\end{document}

答案1

灵活且准确对齐对象的一个​​选项是使用该包tikz(分三步)。

第一步,定义六个节点为\node (<name>) {<object>};,其中<object>是文本、表格或图形......,

然后使用类似或的\node (<name>) [<position>] {<object>};语法添加它们的相对位置right = of <name of other node>below= of ...

最后,定义节点的大小(minimum size=)并更改其间距的默认值以适合页面(node distance=)。

您可以在每一步之后编译文档来查看进度。

b

\documentclass[11pt,a4paper]{report}
\usepackage{geometry}
\geometry{
    landscape,
    a4paper,
    total={275mm,190mm},
    left=10mm,
    bottom=20mm,
}

\usepackage{graphicx}

\usepackage{tikz}% needed <<<<<<<<<
\usetikzlibrary {positioning}% <<<<<<<<<<<<<
    
\begin{document}
  
    \begin{tikzpicture}[minimum size=0.25\linewidth, node distance=-1.0cm and 0.5cm ]%first parameter is the vertical node distance and the second is the horizontal node distance
        \node  (Ini) {%
            \begin{tabular}{cc}
                \hline\hline\noalign{\smallskip}
                Time interval    &  s     \\
                45               & g      \\
                \noalign{\smallskip}\hline\noalign{\smallskip}
        \end{tabular}};
        \node  (Im1)[right= of Ini] {\includegraphics[width=0.25\linewidth]{example-image-a}};
        \node  (Im2)[below= of Ini] {\includegraphics[width=0.25\linewidth]{example-image-b}};
        \node  (Im3)[below= of Im1] {\includegraphics[width=0.25\linewidth]{example-image-b}};
        \node  (Im4)[below= of Im2] {\includegraphics[width=0.25\linewidth]{example-image-c}};
        \node  (Im5)[below= of Im3] {\includegraphics[width=0.25\linewidth]{example-image-c}};
      
    \end{tikzpicture}
    
\end{document}

答案2

使用tabular和单个tablefigure环境。

\documentclass{article}

\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{booktabs}


\begin{document}


\begin{table}[htp]
\centering

\begin{tabular}{cc}
% the table
\begin{tabular}{cc}
\toprule
Time interval    &  s     \\
\midrule
45               & g      \\
\bottomrule
\end{tabular}
& 
% the top right picture
\includegraphics[valign=c,width=0.25\textwidth]{example-image}
\\
\addlinespace
\includegraphics[valign=c,width=0.25\textwidth]{example-image}
&
\includegraphics[valign=c,width=0.25\textwidth]{example-image}
\\
\addlinespace
\includegraphics[valign=c,width=0.25\textwidth]{example-image}
&
\includegraphics[valign=c,width=0.25\textwidth]{example-image}
\end{tabular}
\end{table}

\end{document}

在此处输入图片描述

答案3

可能存在一个比使用minipages 或任何其他与制表符相关的构造更轻松地解决此问题的包。我尚不知道有这样的包。

在下面的回答中我假设你会有一个类似大小相等的 3x2 个单元格的网格。

此解决方案基于表格结构。Xtabularx均匀划分表格。为了强制固定高度,我还添加了parbox。每个单元格都可以包含文本和图像,就像在常规段落中一样。

唯一的问题是,在类似 的环境中,文本与图像混合tabular会导致文本被推向图像的底部。解决此问题的一种方法是使用\raisebox{}{};也许不是最好的,但它很有效。

下面的代码还有一些更易于使用的宏

   
在此处输入图片描述 在此处输入图片描述
\documentclass{article}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{tabularx}

\newcommand\ctext[1]{%
    \parbox[t][0.33\textheight]{\linewidth}{#1}}
\newcommand\cimage[1]{%
    \parbox[t][0.33\textheight]{\linewidth}{%
      \centering%
      \raisebox{-\dimexpr(\totalheight-10pt)}{#1}}}

\begin{document}


\begin{tabularx}{\textwidth}{@{}X X@{}}
    \ctext{%
      A regular paragraph.

      A list:
      \begin{itemize}
        \item with
        \item a few
        \item items.
      \end{itemize}

      Followed by another text.} &
    \cimage{\includegraphics[width=\linewidth]{example-image}} \\
    \cimage{\includegraphics[width=\linewidth]{example-image-a}} &
    \cimage{\includegraphics[width=\linewidth]{example-image-b}} \\
    \cimage{\includegraphics[width=\linewidth]{example-image-c}} &
    \cimage{\includegraphics[width=\linewidth]{example-image-golden}}
\end{tabularx}

\clearpage
\begin{tabularx}{\textwidth}{@{}X X@{}}
    \ctext{%
        \centering A centred\\multi-lined text.

        \vspace{3ex}Small images} &
    \cimage{\includegraphics[width=0.75\linewidth]{example-image-b}} \\
    \cimage{\includegraphics[width=0.75\linewidth]{example-image-c}} &
    \cimage{\includegraphics[width=0.75\linewidth]{example-image}} \\
    \cimage{\includegraphics[width=0.75\linewidth]{example-image-a}} &
    \cimage{\includegraphics[width=0.75\linewidth]{example-image-golden}}
\end{tabularx}

\end{document}

相关内容