Highlight text with colored underline link to margin notes

marginnotetodonotes

I am trying to achieve the effect in the image below where text is highlighted with a coloured underline and linked to margin notes with partial borders that are also coloured. I have done some research and seen people achieve an effect close to what I am after with soul (although it does seem a bit ancient and unsupported) or alternatively todonotes. I have no idea how one might achieve this aesthetic here and would really appreciate some pointers.

Highlighted-text-linked-to-margin-notes



Best Answer

Welcome to StackExchange! And thanks for the interesting question which just happens to dovetail nicely with a project of mine.

The example that you show was likely created with the help of Adobe's InDesign or Illustrator, or similar software, which I used and supported for years. The advantage that TeX has (or, rather, one of them) is that some of the more tedious tasks in creating a document such as this can be -- to a certain extent -- automated. Even so, there is generally at least some tweaking of the final result to get something that approximates reasonably closely to an ideal. The following code allows for a relatively large number of tweaks. I was at a loss to see how, in TeX, both to underline and highlight text at the same time. Fortunately, Steven Segletes came brilliantly to the rescue as you can see for yourself: Is it possible to highlight and underline at the same time? (also serves as an excellent and practical object lesson in the extraordinary usefulness of being a part of this community).

The code, though prolix, is fairly straightforward and reasonably well commented. The example code uses a large number of the tweaks, and will repay close inspection.

Two important things: First, this code requires to be run twice. If you run the code and it looks simply awful, then just run it again and all should be well. Second, in the course of writing my code, I found a small problem for which Steven speedily supplied a fix, with more on the way; my code contains the original fix.

I did take one liberty. In the original, the side notes (both left and right) have colored rules on their left. I suggest that the rules would be more attractive on the side of the side notes (awful turn of phrase) that face the main text -- right side rule for side notes on the left (text also right-justified), and left side rule for notes on the right)-- and from which all the arrows can start.

It is entirely likely that this may not be my last word on this subject... As is often the case with TeX, there are many, many ways of solving a problem. This is just one such...

\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}

marginnotes with arrows

Update

To my original query about underlining and highlighting (Is it possible to highlight and underline at the same time?) Javier Bezos suggested that I take a look at soulpos.sty which I did. I've incorporated its use (easy-peasy) into my code (there are no changes in the interface):

\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}

soulpos version

Update 2

I was a little unhappy with requiring Gentle User to fiddle with geometry.sty in order to create a document. I herewith change that with the addition of an environment, mkcalloutdoc. It takes two arguments: the width and the (supposed) height of the main text -- both can be changed at will. There is also an option, mainframe that will draw a box around the main text. There are no changes to the \myhl command.

Note: The side notes are placed using the TikZ overlay option. You will notice that the side notes extend beyond the left and right margins (shown with the showframe option to geometry.sty) with no complaint from TeX: the overlay option makes the side notes essentially invisible to TeX's space calculations. You can adjust the notewidth option to the mkcalloutdoc environment or the width (first argument to mkcalloutdoc) if you need to fit the document between margins.

\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}

Update 2

Related Question