更新

更新

我正在尝试实现下图中的效果,即文本用彩色下划线突出显示,并链接到带有部分边框的边注,这些边框也是彩色的。我做了一些研究,看到人们用 soul(虽然它看起来有点古老且不受支持)或 todonotes 实现了与我想要的效果相近的效果。我不知道如何在这里实现这种美感,非常感谢一些指点。

突出显示的文本链接到边注



答案1

欢迎来到 StackExchange!感谢您提出的有趣问题,它恰好与我的一个项目完美契合。

您展示的示例很可能是在 Adob​​e 的 InDesign 或 Illustrator 或类似软件的帮助下创建的,我多年来一直使用和支持这些软件。TeX 的优势(或者说其中之一)是,创建此类文档时的一些较繁琐的任务可以在一定程度上实现自动化。即便如此,通常至少需要对最终结果进行一些调整,以获得与理想结果相当接近的结果。以下代码允许进行相对大量的调整。我不知道如何在 TeX 中同时使用下划线同时突出显示文本。幸运的是,Steven Segletes 巧妙地解决了这个问题,您可以亲眼看到:是否可以同时突出显示和下划线?(也是一次极好且实用的示范课,展示了成为这个社区一员的非凡用处)。

代码虽然冗长,但相当简单,注释也相当完善。示例代码使用了大量调整,值得仔细检查。

两件重要的事情:首先,这段代码需要运行两次。如果你运行代码,发现它看起来很糟糕,那么只需再次运行它,一切都会好起来。其次,在编写代码的过程中,我发现了一个小问题,Steven 很快就修复了这个问题,而且正在修复更多问题;我的代码包含原来的使固定。

我确实做了一点改动。在原版中,侧注(左右两侧)的线条都有彩色标记。左边。我建议,规则应该更吸引人,放在面向正文的旁注(糟糕的措辞)一侧——右侧规则适用于左侧的旁注(文本也右对齐),左侧规则适用于右侧的注释)——所有箭头都可以从这里开始。

这很可能不是我对这个问题的最后评论... 正如 TeX 的情况一样,解决问题的方法有很多种。这只是其中一种...

\documentclass{article}

\usepackage{censor}[2021-12-23]
%% Adjust papersize and textwidth to suit:
\usepackage[papersize={5.5in,8.5in},textwidth=2.25in,centering,top=0.5in,bottom=0.5in]{geometry}
\usepackage{keyval,xcolor,stackengine,fontspec,xparse,tikzpagenodes,tikz,graphicx}

\usetikzlibrary{calc,positioning}

%% |=====8><-----| %%

\newcounter{tagnum}
\newif\ifleftnote
\newif\ifdrawframe
\newlength{\ahyshift}
\newlength{\sahyshift}

\def\movenote{0pt}
\def\notecolor{yellow}
\def\secondarrow{0}
\def\ahyshift{0pt}
\def\sahyshift{0pt}
\def\ahxshift{0pt}
\def\sahxshift{0pt}
\def\arrowbaseshift{0pt}
\def\abshift{0pt}
\def\sabshift{0pt}
\drawframetrue

\makeatletter
\define@key{hlulnote}{movenote}{\def\movenote{#1}}
\define@key{hlulnote}{notecolor}{\def\notecolor{#1}}
\define@key{hlulnote}{leftnote}[true]{\csname leftnote#1\endcsname}
\define@key{hlulnote}{drawframe}[true]{\csname drawframe#1\endcsname}
\define@key{hlulnote}{secondarrow}{\def\secondarrow{#1}}
\define@key{hlulnote}{arrowyshift}{\def\ahyshift{#1}}
\define@key{hlulnote}{secondarrowyshift}{\def\sahyshift{#1}}
\define@key{hlulnote}{arrowxshift}{\def\ahxshift{#1}}
\define@key{hlulnote}{secondarrowxshift}{\def\sahxshift{#1}}
\define@key{hlulnote}{arrowbaseshift}{\def\abshift{#1}}
\define@key{hlulnote}{sarrowbaseshift}{\def\sabshift{#1}}
\makeatother

%% |=====8><-----| %%

%% Alterations to censor.sty generously supplied by Steven Segletes, its author:

\makeatletter
    \renewcommand\@cenword[1]{\bgroup
      \renewcommand\stacktype{L}%
      \setstackgap{L}{0pt}%
      \stackon{\stackon{\censorrule{\widthofpbox{#1}}}
                {\censorul{\widthofpbox{#1}}}}%
        {#1}%
      \egroup
    }

    \def\censpace{\rlap{\censorrule{\spacelap}}%
      \rlap{\censorul{\spacelap}} \llap{\censorrule{\spacelap}}%
      \llap{\censorul{\spacelap}}}
    \let\sv@censpace\censpace
\makeatother

\censorruledepth -\dp\strutbox
\censorruleheight \baselineskip

\renewcommand\censorrule[1]{%
    \textcolor{\myhlcolor}{%
        \protect\rule[\censorruledepth]{#1}{\censorruleheight}%
    }%
}

\def\censorul#1{\textcolor{\myulcolor}{\protect\rule[\censorruledepth]{#1}{1pt}}}

%% |=====8><-----| %%

% Keyval options:
%   movenote -- moves side note up (positive distance) or down (negative distance)
%   notecolor -- color used for underlining, and highlighting (a 30% tint)
%   leftnote -- places side note on the left, reverse, if necessary with <leftnote=false>
%       the default is for side notes to be on the right.
%   drawframe -- draws the rule (in notecolor) on the left or right of the side note
%   secondarrow -- allow for having a second arrow, as in secondarrow=3, where '3'
%       is the third highlighted area. This can ONLY apply to an *already highlighted area of text.
% Keyval arrowhead x/y position correction:
%   arrowyshift -- move the arrow head for the main arrow, +=up, -=\down
%   secondarrowyshift -- move the second arrow head, +=up, -=\down
%   arrowxshift -- move the arrow head for the main arrow, +=left, -=right
%   secondarrowxshift -- move the second arrow head, +=left, -=right
%   arrowbaseshift -- shifts the base of the main arrow, +=up, -=\down
%   sarrowbaseshift -- shifts the base of the secondary arrow, +=up, -=\down

% #1 (*)=don't draw primary arrows; #2=keyval (see above); #3=highlighted text; #4=note;
\NewDocumentCommand{\myhl}{s O{} +m +m}{%
    \begingroup
    \setkeys{hlulnote}{#2}%
    \stepcounter{tagnum}%
    \def\myhlcolor{\notecolor!30}%
    \def\myulcolor{\notecolor}%
    \begin{tikzpicture}[overlay,remember picture]
        \coordinate[yshift=1em](b-\thetagnum-tag);% Start of highlighted text
    \end{tikzpicture}%
    \xblackout{#3}%
    \begin{tikzpicture}[overlay,remember picture]
        \coordinate(e-\thetagnum-tag);% End of highlighted text
        %% Base coordinates of highlighted area
        \coordinate (X\thetagnum) at ($(b-\thetagnum-tag)!0.5!(e-\thetagnum-tag)$);% center
        \coordinate (Y\thetagnum) at ([xshift=-6pt]current page text area.north west|-X\thetagnum);% R
        \coordinate (Z\thetagnum) at ([xshift=6pt]current page text area.north east|-X\thetagnum);% L
        \ifleftnote %% Note on the left...
            \node[yshift=\movenote,left=12pt of Y\thetagnum,
                text width=1in,font=\scriptsize,align=right]
                    (N\thetagnum) {#4};
            \ifdrawframe
                \draw[\myulcolor,very thick] (N\thetagnum.north east) -- (N\thetagnum.south east);
            \fi
            \IfBooleanF{#1}{%
                \draw[very thick,\myulcolor,->] ([yshift=\abshift]N\thetagnum.east) --
                    ([xshift=\ahxshift,yshift=\ahyshift]Y\thetagnum);
            }%
            \ifnum\secondarrow=0
            \else
                \draw[very thick,\myulcolor,->] ([yshift=\sabshift]N\thetagnum.east) to[out=0,in=180]
                    ([xshift=\sahxshift,yshift=\sahyshift]Y\secondarrow);
            \fi
        \else %% ...or note on the right
            \node[yshift=\movenote,right=12pt of Z\thetagnum,text width=1in,font=\scriptsize]
                (N\thetagnum) {#4};
            \ifdrawframe
                \draw[\myulcolor,very thick] (N\thetagnum.north west) -- (N\thetagnum.south west);
            \fi
            \IfBooleanF{#1}{%
                \draw[very thick,\myulcolor,->] ([yshift=\abshift]N\thetagnum.west) --
                    ([xshift=\ahxshift,yshift=\ahyshift]Z\thetagnum);
            }%
            \ifnum\secondarrow=0
            \else
                \draw[very thick,\myulcolor,->] ([yshift=\sabshift]N\thetagnum.west) to[out=180,in=0]
                    ([xshift=\sahxshift,yshift=\sahyshift]Z\secondarrow);
            \fi
        \fi
    \end{tikzpicture}%
    \endgroup
}

%% |=====8><-----| %%

\setmainfont{Hypatia Sans Pro}%% <<<--- change this to suit

\parindent0pt

\begin{document}

\thispagestyle{empty}

\raggedright

\myhl[notecolor=cyan!60!white,leftnote,movenote=-0.125in,arrowyshift=-3pt]{Hey Fellow Austin!}{Assumingly the job pitcher's name is also Austin and creatively integrates that in his message to catch Reif's Attention.}

\bigskip

\myhl[notecolor=pink,arrowyshift=5pt,movenote=0.2in,arrowxshift=-18pt]{I've got a pretty sweet win-win opportunity for you.}{Uses a \textbf{hook} to grab Rief's attention and show that he's not trying to waste his time by simply asking for a job.}
Either you get \$20, or you get
\myhl[notecolor=orange,movenote=-0.175in,arrowxshift=-6pt]{a loyal, hard-working, smart employee!}{Positions himself a \textbf{someone who would add value as an employee} in a playful tone.}

\bigskip

See, I'm about to graduate from college, and I
\myhl*[drawframe=false,notecolor=yellow]{really want a job that not only plays towards my strength, but also fulfills me.}{}
\myhl[notecolor=green!70!blue,leftnote,movenote=-9pt,arrowyshift=-3pt]{I currently have four job offers (Nike, IBM, Walgreens and SC Johnson),}{\textbf{Subtle social proof} to show that he's been given offers at big names before reaching out.}
and while I'm excited about them,
\myhl[movenote=0.125in,notecolor=yellow,secondarrow=4,secondarrowyshift=2pt, sarrowbaseshift=5pt]{I'm not quite sure if I  want to feel like a cog in a machine for the rest of my life. That's why I want to work for an industry leader in a new space like Brew.}{Talks about his \textbf{why.} Positions Morning Brew as an ``industry leader'' and tries to demonstrate:\\(a) culture fit\\(b) values alignment\\(c) passion for company}

\bigskip

My proposal is simple. If you read this message and accept
\myhl*[notecolor=cyan!60!white]{I'll write a full Morning Brew newsletter for tomorrow and send it to you. If it's equal to or better than the one you guys send out, all I ask is for an interview. If it's garbage, you tell me, and I Venmo you \censor{\$}20.}{\textbf{The offer.}\\Promises to do meaningful work to prove his skills in exchange for an interview\par\smallskip \bfseries Austin makes it as easy as possible for Rief to offer a Y/N response.}

\myhl[notecolor=red!70!white,leftnote,movenote=-3pt,arrowyshift=-3pt]{Almost as free as Arbitrage}{Ends on a funny note. Further shows fit as a writer for the Brew.}

\end{document}

带箭头的边注

更新

对于我最初关于下划线和突出显示的问题(是否可以同时突出显示和下划线?) Javier Bezos 建议我看一下,soulpos.sty我照做了。我已将其使用(非常简单)合并到我的代码中(界面没有任何变化):

\documentclass{article}

\usepackage[papersize={5.5in,8.5in},textwidth=2.25in,centering,top=0.5in,bottom=0.5in]{geometry}
\usepackage{keyval,xcolor,soulpos,fontspec,xparse,tikzpagenodes,tikz,graphicx}

\usetikzlibrary{calc,positioning}

%% |=====8><-----| %%

\newcounter{tagnum}
\newif\ifleftnote
\newif\ifdrawframe
\newlength{\ahyshift}
\newlength{\sahyshift}

\def\movenote{0pt}
\def\notecolor{yellow}
\def\secondarrow{0}
\def\ahyshift{0pt}
\def\sahyshift{0pt}
\def\ahxshift{0pt}
\def\sahxshift{0pt}
\def\arrowbaseshift{0pt}
\def\abshift{0pt}
\def\sabshift{0pt}
\drawframetrue

\makeatletter
\define@key{hlulnote}{movenote}{\def\movenote{#1}}
\define@key{hlulnote}{notecolor}{\def\notecolor{#1}}
\define@key{hlulnote}{leftnote}[true]{\csname leftnote#1\endcsname}
\define@key{hlulnote}{drawframe}[true]{\csname drawframe#1\endcsname}
\define@key{hlulnote}{secondarrow}{\def\secondarrow{#1}}
\define@key{hlulnote}{arrowyshift}{\def\ahyshift{#1}}
\define@key{hlulnote}{secondarrowyshift}{\def\sahyshift{#1}}
\define@key{hlulnote}{arrowxshift}{\def\ahxshift{#1}}
\define@key{hlulnote}{secondarrowxshift}{\def\sahxshift{#1}}
\define@key{hlulnote}{arrowbaseshift}{\def\abshift{#1}}
\define@key{hlulnote}{sarrowbaseshift}{\def\sabshift{#1}}
\makeatother

%% |=====8><-----| %%

% Keyval options:
%   movenote -- moves side note up (positive distance) or down (negative distance)
%   notecolor -- color used for underlining, and highlighting (a 30% tint)
%   leftnote -- places side note on the left, reverse, if necessary with <leftnote=false>
%       the default is for side notes to be on the right.
%   drawframe -- draws the rule (in notecolor) on the left or right of the side note
%   secondarrow -- allow for having a second arrow, as in secondarrow=3, where '3'
%       is the third highlighted area. This can ONLY apply to an *already highlighted area of text.
% Keyval arrowhead x/y position correction:
%   arrowyshift -- move the arrow head for the main arrow, +=up, -=\down
%   secondarrowyshift -- move the second arrow head, +=up, -=\down
%   arrowxshift -- move the arrow head for the main arrow, +=left, -=right
%   secondarrowxshift -- move the second arrow head, +=left, -=right
%   arrowbaseshift -- shifts the base of the main arrow, +=up, -=\down
%   sarrowbaseshift -- shifts the base of the secondary arrow, +=up, -=\down

% #1 (*)=don't draw primary arrows; #2=keyval (see above); #3=highlighted text; #4=note;
\NewDocumentCommand{\myhl}{s O{} +m +m}{%
    \begingroup
    \setkeys{hlulnote}{#2}%
    \stepcounter{tagnum}%
    \def\myhlcolor{\notecolor!30}%
    \def\myulcolor{\notecolor}%
    \ulposdef{\newhl}[xoffset=.1em]{%
        \mbox{%
            \color{\myhlcolor}%
            \rule[-.8ex]{\ulwidth}{13pt}%<<<---adjust to suit
            \kern-\ulwidth
            \color{\myulcolor}%
            \rule[-.8ex]{\ulwidth}{1pt}%<<<---adjust to suit
        }%
    }%
    \begin{tikzpicture}[overlay,remember picture]
        \coordinate[yshift=1em](b-\thetagnum-tag);% Start of highlighted text
    \end{tikzpicture}%
    \newhl{#3}%
    \begin{tikzpicture}[overlay,remember picture]
        \coordinate(e-\thetagnum-tag);% End of highlighted text
        %% Base coordinates of highlighted area
        \coordinate (X\thetagnum) at ($(b-\thetagnum-tag)!0.5!(e-\thetagnum-tag)$);% center
        \coordinate (Y\thetagnum) at ([xshift=-6pt]current page text area.north west|-X\thetagnum);% R
        \coordinate (Z\thetagnum) at ([xshift=6pt]current page text area.north east|-X\thetagnum);% L
        \ifleftnote %% Note on the left...
            \node[yshift=\movenote,left=12pt of Y\thetagnum,
                text width=1in,font=\scriptsize,align=right]
                    (N\thetagnum) {#4};
            \ifdrawframe
                \draw[\myulcolor,very thick] (N\thetagnum.north east) -- (N\thetagnum.south east);
            \fi
            \IfBooleanF{#1}{%
                \draw[very thick,\myulcolor,->] ([yshift=\abshift]N\thetagnum.east) --
                    ([xshift=\ahxshift,yshift=\ahyshift]Y\thetagnum);
            }%
            \ifnum\secondarrow=0
            \else
                \draw[very thick,\myulcolor,->] ([yshift=\sabshift]N\thetagnum.east) to[out=0,in=180]
                    ([xshift=\sahxshift,yshift=\sahyshift]Y\secondarrow);
            \fi
        \else %% ...or note on the right
            \node[yshift=\movenote,right=12pt of Z\thetagnum,text width=1in,font=\scriptsize]
                (N\thetagnum) {#4};
            \ifdrawframe
                \draw[\myulcolor,very thick] (N\thetagnum.north west) -- (N\thetagnum.south west);
            \fi
            \IfBooleanF{#1}{%
                \draw[very thick,\myulcolor,->] ([yshift=\abshift]N\thetagnum.west) --
                    ([xshift=\ahxshift,yshift=\ahyshift]Z\thetagnum);
            }%
            \ifnum\secondarrow=0
            \else
                \draw[very thick,\myulcolor,->] ([yshift=\sabshift]N\thetagnum.west) to[out=180,in=0]
                    ([xshift=\sahxshift,yshift=\sahyshift]Z\secondarrow);
            \fi
        \fi
    \end{tikzpicture}%
    \endgroup
}

%% |=====8><-----| %%

\setmainfont{Hypatia Sans Pro}%% <<<--- change this to suit

\parindent0pt

\begin{document}

\thispagestyle{empty}

\raggedright

\myhl[notecolor=cyan!60!white,leftnote,movenote=-0.125in,arrowyshift=-3pt]{Hey Fellow Austin!}{Assumingly the job pitcher's name is also Austin and creatively integrates that in his message to catch Reif's Attention.}

\bigskip

\myhl[notecolor=pink,arrowyshift=5pt,movenote=0.2in,arrowxshift=-18pt]{I've got a pretty sweet win-win opportunity for you.}{Uses a \textbf{hook} to grab Rief's attention and show that he's not trying to waste his time by simply asking for a job.}
Either you get \$20, or you get
\myhl[notecolor=orange,movenote=-0.175in,arrowxshift=-6pt]{a loyal, hard-working, smart employee!}{Positions himself a \textbf{someone who would add value as an employee} in a playful tone.}

\bigskip

See, I'm about to graduate from college, and I
\myhl*[drawframe=false,notecolor=yellow]{really want a job that not only plays towards my strength, but also fulfills me.}{}
\myhl[notecolor=green!70!blue,leftnote,movenote=-9pt,arrowyshift=-3pt]{I currently have four job offers (Nike, IBM, Walgreens and SC Johnson),}{\textbf{Subtle social proof} to show that he's been given offers at big names before reaching out.}
and while I'm excited about them,
\myhl[movenote=0.125in,notecolor=yellow,secondarrow=4,secondarrowyshift=2pt, sarrowbaseshift=5pt]{I'm not quite sure if I  want to feel like a cog in a machine for the rest of my life. That's why I want to work for an industry leader in a new space like Brew.}{Talks about his \textbf{why.} Positions Morning Brew as an ``industry leader'' and tries to demonstrate:\\(a) culture fit\\(b) values alignment\\(c) passion for company}

\bigskip

My proposal is simple. If you read this message and accept
\myhl*[notecolor=cyan!60!white]{I'll write a full Morning Brew newsletter for tomorrow and send it to you. If it's equal to or better than the one you guys send out, all I ask is for an interview. If it's garbage, you tell me, and I Venmo you \$20.}{\textbf{The offer.}\\Promises to do meaningful work to prove his skills in exchange for an interview\par\smallskip \bfseries Austin makes it as easy as possible for Rief to offer a Y/N response.}

\myhl[notecolor=red!70!white,leftnote,movenote=-3pt,arrowyshift=-3pt]{Almost as free as Arbitrage}{Ends on a funny note. Further shows fit as a writer for the Brew.}

% \bigskip

% \includegraphics[width=2.4in]{HXUio}

\end{document}

灵魂版

更新 2

我对需要 Gentle User 来摆弄才能创建文档感到有点不满意geometry.sty。我在此通过添加环境来改变这种情况。mkcalloutdoc它需要两个参数:正文的宽度和(假定的)高度——两者都可以随意更改。还有一个选项,mainframe它将在正文周围绘制一个框。命令没有任何变化\myhl

笔记:侧注使用 TiZoverlay选项。您会注意到,旁注超出了左右边距(使用 选项显示showframegeometry.sty,而 TeX 没有任何抱怨:该overlay选项使旁注在 TeX 的空间计算中基本上不可见。如果您需要将文档放在边距之间,您可以将notewidth选项调整为mkcalloutdoc环境或宽度( 的第一个参数)。mkcalloutdoc

\documentclass{article}

\usepackage[%showframe,
    papersize={5.5in,8.5in},margin=0.75in]{geometry}
\usepackage{keyval,xcolor,soulpos,fontspec,xparse,tikz,graphicx}

\usetikzlibrary{calc,positioning}

%% |=====8><-----| %%

\newcounter{tagnum}%% Keeps track of margin notes
\newcounter{docnum}%% Keeps track of highlight/callout graphics
\newif\ifleftnote %% Is note on left?
\newif\ifshowmainframe %% Show the frame around a highlight/callout graphic
\newif\ifdrawframe %% Draw rules on the sides of side notes
\newlength{\ahyshift} %% Shift main arrowhead
\newlength{\sahyshift} %% Shift secondary arrowhead

%% Defaults:
\def\notewidth{1in} %% The width of the side notes -- option to mkcalloutdoc environment
\def\movenote{0pt}
\def\notecolor{yellow}
\def\secondarrow{0}
\def\ahyshift{0pt}
\def\sahyshift{0pt}
\def\ahxshift{0pt}
\def\sahxshift{0pt}
\def\arrowbaseshift{0pt}
\def\abshift{0pt}
\def\sabshift{0pt}
\drawframetrue

\makeatletter
\define@key{hlulnotem}{notewidth}{\def\notewidth{#1}}
\define@key{hlulnote}{movenote}{\def\movenote{#1}}
\define@key{hlulnote}{notecolor}{\def\notecolor{#1}}
\define@key{hlulnote}{leftnote}[true]{\csname leftnote#1\endcsname}
\define@key{hlulnote}{drawframe}[true]{\csname drawframe#1\endcsname}
\define@key{hlulnote}{secondarrow}{\def\secondarrow{#1}}
\define@key{hlulnote}{arrowyshift}{\def\ahyshift{#1}}
\define@key{hlulnote}{secondarrowyshift}{\def\sahyshift{#1}}
\define@key{hlulnote}{arrowxshift}{\def\ahxshift{#1}}
\define@key{hlulnote}{secondarrowxshift}{\def\sahxshift{#1}}
\define@key{hlulnote}{arrowbaseshift}{\def\abshift{#1}}
\define@key{hlulnote}{sarrowbaseshift}{\def\sabshift{#1}}
\define@key{hlulnotem}{mainframe}[true]{\csname showmainframe#1\endcsname}
\makeatother

%% |=====8><-----| %%

\NewDocumentEnvironment{mkcalloutdoc}{s O{} m m}{%
    \stepcounter{docnum}% Numbers the highlight/callout graphics to make each unique
    \setkeys{hlulnotem}{#2}
    \ifshowmainframe \def\tmpdraw{black}\else\def\tmpdraw{none}\fi
    \begin{minipage}[#4]{#3}
        \begin{tikzpicture}[overlay,remember picture]
            \node[draw=\tmpdraw,
            minimum width=#3,minimum height=#4,
            name=calloutdoc-\thedocnum,anchor=north west] at (0,0) {};
        \end{tikzpicture}%
        \par
        \nointerlineskip
        \ignorespaces
}{%
    \end{minipage}
}

% Keyval options:
%   movenote -- moves side note up (positive distance) or down (negative distance)
%   notecolor -- color used for underlining, and highlighting (a 30% tint)
%   leftnote -- places side note on the left, reverse, if necessary with <leftnote=false>
%       the default is for side notes to be on the right.
%   drawframe -- draws the rule (in notecolor) on the left or right of the side note
%   secondarrow -- allow for having a second arrow, as in secondarrow=3, where '3'
%       is the third highlighted area. This can ONLY apply to an *already highlighted area of text.
% Keyval arrowhead x/y position correction:
%   arrowyshift -- move the arrow head for the main arrow, +=up, -=\down
%   secondarrowyshift -- move the second arrow head, +=up, -=\down
%   arrowxshift -- move the arrow head for the main arrow, +=left, -=right
%   secondarrowxshift -- move the second arrow head, +=left, -=right
%   arrowbaseshift -- shifts the base of the main arrow, +=up, -=\down
%   sarrowbaseshift -- shifts the base of the secondary arrow, +=up, -=\down

% #1 (*)=don't draw primary arrows; #2=keyval (see above); #3=highlighted text; #4=note;
\NewDocumentCommand{\myhl}{s O{} +m +m}{%
   \begingroup
   \setkeys{hlulnote}{#2}%
   \stepcounter{tagnum}%
   \def\myhlcolor{\notecolor!30}%
   \def\myulcolor{\notecolor}%
   \ulposdef{\newhl}[xoffset=.1em]{%
       \mbox{%
           \color{\myhlcolor}%
           \rule[-.8ex]{\ulwidth}{1.2em}%<<<---adjust to suit
           \kern-\ulwidth
           \color{\myulcolor}%
           \rule[-.8ex]{\ulwidth}{1pt}%<<<---adjust to suit
       }%
   }%
   \begin{tikzpicture}[overlay,remember picture]
       \coordinate[yshift=1em](b-\thetagnum-\thedocnum-tag);% Start of highlighted text
   \end{tikzpicture}%
   \newhl{#3}%
   \begin{tikzpicture}[overlay,remember picture]
       \coordinate(e-\thetagnum-\thedocnum-tag);% End of highlighted text
       %% Base coordinates of highlighted area
        \coordinate (X\thetagnum-\thedocnum) at
            ($(b-\thetagnum-\thedocnum-tag)!0.5!(e-\thetagnum-\thedocnum-tag)$);% center
        \coordinate (Y\thetagnum-\thedocnum) at
            ([xshift=-6pt]calloutdoc-\thedocnum.north west|-X\thetagnum-\thedocnum);% R
        \coordinate (Z\thetagnum-\thedocnum) at
            ([xshift=6pt]calloutdoc-\thedocnum.north east|-X\thetagnum-\thedocnum);% L
        \ifleftnote %% Note on the left...
           \node[yshift=\movenote,left=12pt of Y\thetagnum-\thedocnum,
               text width=\notewidth,font=\scriptsize,align=right]
                   (N\thetagnum-\thedocnum) {#4};
           \ifdrawframe
               \draw[\myulcolor,very thick]
                (N\thetagnum-\thedocnum.north east) -- (N\thetagnum-\thedocnum.south east);
           \fi
           \IfBooleanF{#1}{%
               \draw[very thick,\myulcolor,->] ([yshift=\abshift]N\thetagnum-\thedocnum.east) --
                   ([xshift=\ahxshift,yshift=\ahyshift]Y\thetagnum-\thedocnum);
           }%
           \ifnum\secondarrow=0
           \else
               \draw[very thick,\myulcolor,->]
                    ([yshift=\sabshift]N\thetagnum-\thedocnum.east) to[out=0,in=180]
                   ([xshift=\sahxshift,yshift=\sahyshift]Y\secondarrow-\thedocnum);
           \fi
       \else %% ...or note on the right
           \node[yshift=\movenote,
                right=12pt of Z\thetagnum-\thedocnum,text width=\notewidth,font=\scriptsize]
               (N\thetagnum-\thedocnum) {#4};
           \ifdrawframe
               \draw[\myulcolor,very thick]
                (N\thetagnum-\thedocnum.north west) -- (N\thetagnum-\thedocnum.south west);
           \fi
           \IfBooleanF{#1}{%
               \draw[very thick,\myulcolor,->] ([yshift=\abshift]N\thetagnum-\thedocnum.west) --
                   ([xshift=\ahxshift,yshift=\ahyshift]Z\thetagnum-\thedocnum);
           }%
           \ifnum\secondarrow=0
           \else
               \draw[very thick,\myulcolor,->]
                ([yshift=\sabshift]N\thetagnum-\thedocnum.west) to[out=180,in=0]
                   ([xshift=\sahxshift,yshift=\sahyshift]Z\secondarrow-\thedocnum);
           \fi
        \fi
   \end{tikzpicture}%
   \endgroup
}

%% |=====8><-----| %%

\setmainfont{Hypatia Sans Pro}%% <<<--- change this to suit

\parindent0pt

\begin{document}

\thispagestyle{empty}

This is the first sample:

\medskip

\begingroup\centering

\begin{mkcalloutdoc}{2.25in}{5in}

\myhl[notecolor=cyan!60!white,leftnote,movenote=-0.3in,arrowyshift=-3pt]{Hey Fellow Austin!}{Assumingly the job pitcher's name is also Austin and creatively integrates that in his message to catch Reif's Attention.}

\bigskip

\myhl[notecolor=pink,arrowyshift=5pt,movenote=0.2in]{I've got a pretty sweet win-win opportunity for you.}{Uses a \textbf{hook} to grab Rief's attention and show that he's not trying to waste his time by simply asking for a job.}
Either you get \$20, or you get
\myhl[notecolor=orange,movenote=-0.175in,arrowxshift=0pt]{a loyal, hard-working, smart employee!}{Positions himself a \textbf{someone who would add value as an employee} in a playful tone.}

\bigskip

See, I'm about to graduate from college, and I
\myhl*[drawframe=false,notecolor=yellow]{really want a job that not only plays towards my strength, but also fulfills me.}{}
\myhl[notecolor=green!70!blue,leftnote,movenote=-9pt,arrowyshift=-3pt]{I currently have four job offers (Nike, IBM, Walgreens and SC Johnson),}{\textbf{Subtle social proof} to show that he's been given offers at big names before reaching out.}
and while I'm excited about them,
\myhl[movenote=0.125in,notecolor=yellow,secondarrow=4,secondarrowyshift=2pt, sarrowbaseshift=5pt]{I'm not quite sure if I  want to feel like a cog in a machine for the rest of my life. That's why I want to work for an industry leader in a new space like Brew.}{Talks about his \textbf{why.} Positions Morning Brew as an ``industry leader'' and tries to demonstrate:\\(a) culture fit\\(b) values alignment\\(c) passion for company}

\bigskip

My proposal is simple. If you read this message and accept
\myhl*[notecolor=cyan!60!white]{I'll write a full Morning Brew newsletter for tomorrow and send it to you. If it's equal to or better than the one you guys send out, all I ask is for an interview. If it's garbage, you tell me, and I Venmo you \$20.}{\textbf{The offer.}\\Promises to do meaningful work to prove his skills in exchange for an interview\par\smallskip \bfseries Austin makes it as easy as possible for Rief to offer a Y/N response.}

\myhl[notecolor=red!70!white,leftnote,movenote=-3pt,arrowyshift=-3pt]{Almost as free as Arbitrage}{Ends on a funny note. Further shows fit as a writer for the Brew.}

\end{mkcalloutdoc}

\endgroup

\bigskip

And now another:

\medskip

\begingroup
\centering

\begin{mkcalloutdoc}[mainframe]{2in}{1.5in}
    This is \myhl[notecolor=purple]{Simple...}%\dots gives "There is no … ("2026) in font ectt1000!"
    {Not really\dots} and really should not pose any serious problem. Yeah. Right.
\end{mkcalloutdoc}

\endgroup

\end{document}

更新 2

相关内容