答案1
另一种方法是使用表格,我tabularray
在这里使用:
\documentclass[12pt]{article}
\usepackage{tabularray}
\usepackage{tikz}
\UseTblrLibrary{booktabs,counter,varwidth}
\newcounter{mycnta}
\newcommand{\mycnta}{\stepcounter{mycnta}\arabic{mycnta}}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm]{geometry}
\usepackage{caption}
\usepackage{blindtext}
\begin{document}
\textbf{BAGIAN PERTAMA}
\vspace{3mm}
\begin{tblr}{colspec={Q[.5cm,c]X[j]Q[c,3cm]},rows={m},cell{1-5}{1}={r=1,c=1}{h}}
\mycnta. & Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobor-
tis facilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent
imperdiet mi nec ante. Donec ullamcorper, felis non sodales commodo,
lectus velit ultrices augue, a dignissim nibh lectus placerat pede. Vivamus
nunc nunc, molestie ut, ultricies vel, semper in, velit. Ut porttitor. Prae-
sent in sapien. & \tikz[baseline=(current bounding box.center)] \draw (0,0) rectangle (2.5,1.5); \\
& & \\
\mycnta. & Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobor-
tis facilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent
imperdiet mi nec ante. Donec ullamcorper, felis non sodales commodo,
lectus velit ultrices augue, a dignissim nibh lectus placerat pede. Vivamus
nunc nunc, molestie ut, ultricies vel, semper in, velit. Ut porttitor. Prae-
sent in sapien. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Duis fringilla tristique neque. Sed interdum libero ut metus. & \tikz[baseline=(current bounding box.center)] \draw (0,0) rectangle (2.5,1.5); \\
& & \\
\mycnta. & \blindtext & \tikz[baseline=(current bounding box.center)] \draw (0,0) rectangle (2.5,1.5); \\
\end{tblr}
\end{document}
答案2
我使用TikZ
为项目的文本创建一个节点,并在旁边绘制一个矩形。解决方案主要基于 的使用(current bounding box)
。
评论。 节点相对于文本的对齐基于@Marco Daniel 的回答 如何制作一个 tikz 节点,与文本的其余部分顶部对齐?。
代码
\documentclass[11pt, a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\begin{document}
\newcommand{\ibox}[1]{%
\begin{tikzpicture}[baseline={%
([yshift={-\ht\strutbox +.2ex}]current bounding box.north)
},
outer sep=0pt, inner sep=0pt]
\path (0, 0)
node[anchor=north west,
inner sep=0, outer sep=0,
text width=\linewidth] (tmp)
{#1};
\draw (\linewidth +3ex, 0) rectangle
($(current bounding box.south east) +(\marginparwidth+5ex, 0)$);
\end{tikzpicture}
}
\section{Verification}
\begin{enumerate}
\item \ibox{\lipsum[1]}
\item \ibox{\lipsum[2]}
\end{enumerate}
\end{document}