答案1
您可能想尝试matrix
中的方法TiKZ
。这只是一个例子,但可以添加许多定位和样式方面。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\tikzset{squarestyle/.style={draw,text width=2cm,text height=1cm}}
\tikzset{matrixstyle/.style={matrix of nodes,nodes in empty cells,ampersand replacement=\&,column sep=2em,row sep=2ex}}
\begin{document}
\begin{tikzpicture}
\matrix (m) [%
matrixstyle,
column 2/.style={nodes={squarestyle}},
column 3/.style={nodes={squarestyle}},
]
{%
Something \& A \& B \& Text \\
Something \& A \& B \& Text \\
};
\end{tikzpicture}
\end{document}
答案2
直接的方法可以是这样的(显然,您将为框定义宏,但这只是为了提供一个想法),使用基本的 LaTeX 框:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\parindent=0pt\relax % no indent at the start of the paragraph
\fbox{\parbox[t][3cm][c]{5cm}{
Some text
}}\hspace{0.5cm} %% this is the horizontal separation
\fbox{\parbox[t][3cm][c]{5cm}{
Some text
\[ f(x) = formula \]
}}
\vspace{0.5cm} % and this the vertical one --- notice you star a paragraph here (blank lines)
\fbox{\parbox[t][3cm][c]{5cm}{
Some text
}}\hspace{0.5cm}
\fbox{\parbox[t][3cm][c]{5cm}{
Some text
}}
%% repeat as needed
\end{document}
结果是
或者 ...
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\parindent=0pt\relax
\newcommand{\mybox}[1]{\fbox{\parbox[c][2cm][c]{3cm}{#1}}}
\begin{document}
Text \mybox{some text} \quad \mybox{$f(x)$} more text
\bigskip
Text \mybox{some text} \quad \mybox{yeap} and more text
\bigskip
To align it \mybox{you have} \quad \mybox{to use} a tabular or similar...
\end{document}
这使:
显然,您可以使用包裹tcolorbox
为了更好地了解...只需阅读手册并尝试!
答案3
\documentclass{article}
\usepackage{collcell}
\newcolumntype{f}{>{\collectcell\cellframe}l<{\endcollectcell}}
\newcommand*\cellframe[1]{\fbox{\makebox[2em][l]{\strut#1}}}
\begin{document}
\begin{tabular}{lffl}
something & x & & text \\[10pt]
something & & & text \\[10pt]
something & & xy & text \\[10pt]
something & & & text
\end{tabular}
\end{document}
笔记。当然,您可以在其每个单元格中使用数学模式tabular
。