如何在 XeLaTeX 中圈出指向其他文本的段落中的文本

如何在 XeLaTeX 中圈出指向其他文本的段落中的文本

我想知道如何在段落中圈出单词,然后让箭头从圈出的单词指向其他单词,如下所示:

在此处输入图片描述

这只是代码的开始:

\documentclass{article}
\usepackage[most]{tcolorbox}


\begin{document}


This is just some \tcbox[enhanced,colback=green!25]{text that} I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again.

\end{document}

答案1

tikzmarknode这是库中的解决方案tikzmark
您可以定义更多样式和选项,但您已经明白了。
请注意,您可能需要至少两次编译才能获得正确的节点位置。

Tikzmark 评论文本

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}
\tikzset{mynode/.style={inner sep=2pt,fill=cyan!50,draw=blue,line width=1pt,rounded corners}}

This is just some \tikzmarknode[mynode]{A}{text that} I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again.

\begin{tikzpicture}[remember picture, overlay]
    \draw[->,line width=1pt,blue] (A) --++ (1,1) node[above right] {your comment here};
\end{tikzpicture}

\end{document}

答案2

您可以根据需要更改颜色。

\documentclass{article}
\usepackage[most]{tcolorbox}
\newtcbox{\mybox}[1][]{nobeforeafter,tcbox raise base, top=0.2pt,bottom=0.2pt,left=0.1pt,right=0.1pt,before upper=\strut,#1}
\begin{document}
This is just some \mybox{is} \mybox{another}.

This is just some \mybox[enhanced,colback=green!25]{text that} I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again. This is just some text that I will repeat for this section again and again.

\end{document}

在此处输入图片描述

相关内容