为此我有以下代码:
\documentclass{article}
\usepackage[landscape]{geometry}
\newcommand\Block[2]{%
\setlength\fboxsep{0pt}\setlength\fboxrule{0.1pt}% delete
\fbox{% delete
\begin{minipage}[c][.2\textheight][t]{0.5\textwidth}
#1\par #2
\end{minipage}%
}% delete
}
\newcommand\nBlock[2]{%
\setlength\fboxsep{0pt}\setlength\fboxrule{0.1pt}% delete
\fbox{% delete
\begin{minipage}[c][.2\textheight][t]{0.5\textwidth}
#1\par #2
\end{minipage}%
}% delete
}
\newcommand\nnBlock[2]{%
\setlength\fboxsep{0pt}\setlength\fboxrule{0.1pt}% delete
\fbox{% delete
\begin{minipage}[c][.2\textheight][t]{0.5\textwidth}
#1\par #2
\end{minipage}%
}% delete
}
\begin{document}
\noindent
\Block{text}{caption}%
\Block{text}{caption}%
\par\nointerlineskip\noindent
\nBlock{text}{caption}%
\nBlock{text}{caption}%
\par\nointerlineskip\noindent
\nnBlock{text}{caption}%
\nnBlock{text}{caption}%
\end{document}
我该如何为每一行和每个框指定特定长度。我不希望这些框像现在这样相等。非常感谢。
答案1
我想下面的东西应该可以满足您的需要;第一个参数\Block
是文本高度的分数,第二个参数是文本宽度的分数;然后是标题和文本。
\documentclass{article}
\usepackage[landscape]{geometry}
\newenvironment{blocks}
{%
\setlength\fboxsep{0pt}%
\setlength\fboxrule{0.1pt}%
\setlength{\parindent}{0pt}%
\newcommand{\newblocks}{\par\nointerlineskip}%
}
{\par}
\newcommand{\Block}[4]{%
\fbox{%
\begin{minipage}[c][\dimexpr#1\textheight-2\fboxrule][t]{\dimexpr#2\textwidth-2\fboxrule}
#3\par #4
\end{minipage}%
}%
\ignorespaces
}
\begin{document}
\begin{blocks}
\Block{0.2}{0.3}{text}{caption}
\Block{0.2}{0.7}{text}{caption}
\newblocks
\Block{0.3}{0.5}{text}{caption}
\Block{0.3}{0.5}{text}{caption}
\newblocks
\Block{0.2}{0.4}{text}{caption}
\Block{0.2}{0.6}{text}{caption}
\end{blocks}
\end{document}