如何在tex中将一个页面分成四个区域

如何在tex中将一个页面分成四个区域

我想知道如何将一页分成长度和宽度相同的四个框。我在下面附上了一张截图。我试图制作一个有四个框的页面,并在每个框中输入文本。文本将是简短的数学问题。我按照这里的建议做了,并且得到了正确的页面布局,但现在我在每个框中输入文本时遇到了问题。我该如何将文本保留在每个框顶部的线附近?还有,有没有办法在每个框的底部添加一条水平线?我通常使用 word 和 notability 来做这些事情,但制作一页需要太长时间。我用 latex 来写考试。并不是真正的专家,但想学更多。在此处输入图片描述

答案1

这里有一种使用包的可能性tikzpagenodes,它提供了(current page text area)节点,因此它将适应不同的文档类、边距设置等。您必须编译两次。

在此处输入图片描述

\documentclass{article}

\usepackage[margin=1in]{geometry}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}

\tikzset{quarterpage/.style={draw, text width=.47*\textwidth, minimum height=.5*\textheight, 
    minimum width=.5*\textwidth, text depth=.47*\textheight, label={[yshift=8mm]below:\rule{.35\textwidth}{.7pt}}}}

\newcommand{\posA}{($.5*(current page text area.north west)+.5*(current page text area)$)}
\newcommand{\posB}{($.5*(current page text area.north east)+.5*(current page text area)$)}
\newcommand{\posC}{($.5*(current page text area.south west)+.5*(current page text area)$)}
\newcommand{\posD}{($.5*(current page text area.south east)+.5*(current page text area)$)}

\begin{document}

\begin{tikzpicture}[remember picture, overlay]
\node[quarterpage]at\posA{Here is problem 1. Please show your work in the space provided and write your answer at the bottom.};
\node[quarterpage]at\posB{Here is problem 2. Please show your work in the space provided and write your answer at the bottom.};
\node[quarterpage]at\posC{Here is problem 3. Please show your work in the space provided and write your answer at the bottom.};
\node[quarterpage]at\posD{Here is problem 4. Please show your work in the space provided and write your answer at the bottom.};
\end{tikzpicture}

\end{document}

答案2

这是你想要的?

\documentclass[12pt]{article}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
    \thispagestyle{empty}
    \tikz[overlay,remember picture]
    \draw[line width=2pt]($ (current page.north west)+(1cm,-1.2cm)$ ) rectangle ($ (current page.south east)+(-1cm,1.2cm)$);
    \tikz[overlay,remember picture]\draw[line width=1pt]($  (current page.north)+(0,-1.2cm)$ ) rectangle ($ (current page.south)+(0,1.2cm)$);
    \tikz[overlay,remember picture]\draw[line width=1pt]($  (current page.west)+(1cm,0)$ ) rectangle ($ (current page.east)+(-1cm,0)$);
    Here you can write your text...
\end{document}

输出页

答案3

这不是最好的方法,但你可以使用以下方法来实现minipage

\documentclass[12pt]{article}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{blindtext}
\begin{document}
    \thispagestyle{empty}
    \tikz[overlay,remember picture]
    \draw[line width=2pt]($ (current page.north west)+(1cm,-1.2cm)$ ) rectangle ($ (current page.south east)+(-1cm,1.2cm)$);
    \tikz[overlay,remember picture]\draw[line width=1pt]($  (current page.north)+(0,-1.2cm)$ ) rectangle ($ (current page.south)+(0,1.2cm)$);
    \tikz[overlay,remember picture]\draw[line width=1pt]($  (current page.west)+(1cm,0)$ ) rectangle ($ (current page.east)+(-1cm,0)$);
    
    \begin{minipage}[0.4\textheight]{0.4\textwidth}
        \blindtext
    \end{minipage}\hspace{0.12\linewidth}
    \begin{minipage}[0.4\textheight]{0.4\textwidth}
        \blindtext
    \end{minipage}

    \vspace{0.15\textwidth}
    
    \begin{minipage}[0.4\textheight]{0.4\textwidth}
        \blindtext
    \end{minipage}\hspace{0.12\linewidth}
    \begin{minipage}[0.4\textheight]{0.4\textwidth}
        \blindtext
    \end{minipage}

\end{document}

答案4

另一个解决方案是使用tcbraster(来自tcolorbox)。您可以轻松地为每个框定义不同的方面。

\documentclass[a4paper]{article}
\usepackage[margin={1cm}]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\begin{document}
\thispagestyle{empty}
\begin{tcbraster}[raster columns=2, raster rows=2, raster height=\textheight,
    enhanced, sharp corners, raster column skip=-.5mm, 
    raster row skip=-.5mm, colback=white, underlay={\draw[red]([shift={(5mm,5mm)}]frame.south west)--([shift={(-5mm,5mm)}]frame.south east);},
    watermark text={\thetcbrasternum}]
    \begin{tcolorbox}
        \lipsum[1]
    \end{tcolorbox}
    \begin{tcolorbox}
        \lipsum[2]
    \end{tcolorbox}
    \begin{tcolorbox}
        \lipsum[3]
    \end{tcolorbox}
    \begin{tcolorbox}
        \lipsum[4]
    \end{tcolorbox}
\end{tcbraster}
\end{document}

在此处输入图片描述

相关内容