- 不放进盒子里
- 放入盒子里
- 放入盒子里
- 不放进盒子里
- 数字不进入框
我正在使用\begin{enumerate}
该列表。
答案1
我拿了一半此解决方案实现您想要的效果。有关如何优化该效果的更多详细信息,请参阅链接的解决方案。
\documentclass{article}
\usepackage{xparse}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\makeatletter
\NewDocumentCommand{\DrawBox}{s O{}}{%
\tikz[overlay,remember picture]{
\IfBooleanTF{#1}{%
\coordinate (RightPoint) at ($(left |- right)+(\linewidth-\labelsep-\labelwidth,0.0)$);
}{%
\coordinate (RightPoint) at (right.east);
}%
\draw[red,#2]
($(left)+(-0.2em,0.9em)$) rectangle
($(RightPoint)+(0.2em,-0.3em)$);}
}
\makeatother
\begin{document}
\begin{enumerate}
\item \tikzmark{left}doesn't go in box
\item goes in box\hspace{1cm}\tikzmark{right}\DrawBox[thick,red]
\item \tikzmark{left}goes in box
\item doesn't go in box\tikzmark{right}\DrawBox[dashed, very thick,blue]
\item the numbers don't go in box
\end{enumerate}
\end{document}
注意:您可能需要运行两次 LaTeX 才能获得正确的位置。