我想创建一个可以用来创建小册子的模板。
我想要一个 5 行 x 2 列的表格来填充左侧页面,并留出页眉的空间,同样在右侧页面上也留出页脚的空间。
然后我希望能够定义一个自定义命令,可以用问题填充这些单元格(并且能够在其他地方定义这些问题)
到目前为止,我已经了解了以下内容,但我需要帮助来了解要查看哪些课程以及如何将它们组合在一起
理想情况下,我希望能够分别填充两侧表格的 LHS 和 RHS(即不必使用&
,只需使用\question
并让其按顺序沿列向下移动)
\documentclass[a5paper,12pt]{book}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{lipsum}
\usepackage{pst-3dplot}
\oddsidemargin 0.2cm
\evensidemargin 0.2cm
\begin{document}
%% Set up counters for questions
%%
\newcounter{qnumber}
\setcounter{qnumber}{0}
\stepcounter{qnumber}
%% we now define the questions
\newcommand{\question}[1]{
\hline Question X \textsf{#1} & Question Y \textsf{#1} \\ \hline
}
\thispagestyle{empty}
%\noindent
\begin{tabularx}{\linewidth}{|X|X|}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\end{tabularx}
\end{document}
答案1
您可以尝试类似这样的方法。它不是表格,但它将所有布局方面的配置都推到了开头,因此您需要做的就是在文档本身中定义问题(或从外部文件或其他任何地方提取问题)。
它定义了 3 个新命令,每个命令都接受一个参数:
\question{}
排版问题。按照您的格式,这会将“问题”和数字置于衬线字体中,将问题本身置于无衬线字体中。
\questionhead{}
定义页眉。此处页眉位于奇数页,因为这样可以轻松显示结果。但实际上,您可能希望在以下代码中切换odd
并even
制作合适的小册子。
\questionfoot{}
定义页脚。此处页脚位于偶数页,但您可能仍想反转此设置。
该flowfram
包用于划分页面。有关可能性的详细信息,请参阅文档。
页眉和页脚设置在static
框架中。这些将重复其内容,直到重新定义。因此,如果您有多个跨页,您可能需要更改它们。
问题以框架形式排列flow
,问题先从左边流下,再从右边流下,最后到下一页。
geometry
用于设置边距,我认为这符合您的定义。我猜您希望这些边距小一点,并且字体大小可能要小一点,这样才能正常工作。
\documentclass[a5paper,12pt,twoside]{book}
\usepackage[margin=20mm]{geometry}
\usepackage{parskip}
\usepackage{flowfram}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{0pt}{.66\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{0pt}{.49\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{0pt}{.32\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{0pt}{.15\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{0pt}{0pt}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{.525\textwidth}{.66\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{.525\textwidth}{.49\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{.525\textwidth}{.32\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{.525\textwidth}{.15\textheight}
\newflowframe[odd]{.475\textwidth}{.15\textheight}{.525\textwidth}{0pt}
\newflowframe[even]{.475\textwidth}{.15\textheight}{0pt}{.85\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{0pt}{.68\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{0pt}{.51\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{0pt}{.34\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{0pt}{.17\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{.525\textwidth}{.85\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{.525\textwidth}{.68\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{.525\textwidth}{.51\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{.525\textwidth}{.34\textheight}
\newflowframe[even]{.475\textwidth}{.15\textheight}{.525\textwidth}{.17\textheight}
\newstaticframe[even]{\textwidth}{.15\textheight}{0pt}{0pt}[questionfooter]
\newstaticframe[odd]{\textwidth}{.15\textheight}{0pt}{.85\textheight}[questionheader]
\setlength{\ffcolumnseprule}{.5pt}
\setallflowframes{border=none}
\newcounter{qnumber}
\setcounter{qnumber}{0}
\newcommand{\question}[1]{%
\stepcounter{qnumber}%
Question \theqnumber. \textsf{#1}
\newpage}
\newcommand{\questionhead}[1]{%
\setstaticcontents*{questionheader}{#1}}
\newcommand{\questionfoot}[1]{%
\setstaticcontents*{questionfooter}{#1}}
\begin{document}
\thispagestyle{empty}
%\getflowid{\myid}{??}\myid
\questionhead{\centering\large\bfseries Answer ALL questions.}
\questionfoot{\centering\itshape Don't forget to check your work\dots}
\question{Is this a good question? \\ can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a good question? \\ can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\question{Is this a better question?}
\question{Is this a good question? \newline can I do a line break in here?}
\end{document}
生成: