![如何将枚举列表(或其中的一部分)放入框中,不包括编号的项目符号?](https://linux22.com/image/361030/%E5%A6%82%E4%BD%95%E5%B0%86%E6%9E%9A%E4%B8%BE%E5%88%97%E8%A1%A8%EF%BC%88%E6%88%96%E5%85%B6%E4%B8%AD%E7%9A%84%E4%B8%80%E9%83%A8%E5%88%86%EF%BC%89%E6%94%BE%E5%85%A5%E6%A1%86%E4%B8%AD%EF%BC%8C%E4%B8%8D%E5%8C%85%E6%8B%AC%E7%BC%96%E5%8F%B7%E7%9A%84%E9%A1%B9%E7%9B%AE%E7%AC%A6%E5%8F%B7%EF%BC%9F.png)
- 不放进盒子里
- 放入盒子里
- 放入盒子里
- 不放进盒子里
- 数字不进入框
我正在使用\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 才能获得正确的位置。