Is it possible to typeset handwritten comments and annotations in the margins around a paragraph like in the example below?

What would be the closest approximation of this done in LaTeX?

enter image description here


1 Answer 1


Combining results from the questions cited in my comments... namely, doncherry's use of the fts "Teen Spirit" font (http://www.tug.dk/FontCatalogue/teenspirit/) referenced at How do I make my document look like it was written by a Cthulhu-worshipping madman?. I also used my answer at What are the ways to position things absolutely on the page? (adapted for new hook system)

Below, I introduce

\handnote[<angle>]{<x from left>}{<y from top>}{<width>}{<color>}{<content>}

EDITED to introduce the following supporting emphasis markings:


These emphasis markings appear as macros within the context of a \handnote's <content>. Thus, when they constitute the complete content of a given \handnote, they may be freely rotated using the <angle> parameter of \handnote. The use of varying <thickness-scale>s and <width>s allows for repetition of emphasis markings to be avoided.

Also EDITED so that the <content> of \handnote is now top-aligned to the specified vertical coordinate given by <y from top>.

Here is the MWE. The emphasis markings are summarized on page 2 (EDITED to account for LaTeX kernel changes on 2018.12.1):

 \AddToHookNext{shipout/background}{\put(#1,-\dimexpr#2 ){#3}}}
    \scalebox{4}[#6]{% THE 4X SCALING IS LATER COUNTERED BY 0.25
          }{0.25\dimexpr#7\relax}% THE 0.25 IS COUNTERED BY THE EARLIER 4X SCALING
\newcommand\handline             [2][1]{\handxform{.20ex}{0.30ex}{-90}{ 12}{47}{#1}{#2}}
\newcommand\handrightarrow       [2][1]{\handxform{.55ex}{0.45ex}{-90}{ 90}{62}{#1}{#2}}
\newcommand\handleftarrow        [2][1]{\handxform{.55ex}{-0.5ex}{ 90}{ 90}{62}{#1}{#2}}
\newcommand\handhookrightarrow   [2][1]{\handxform{.70ex}{0.60ex}{-90}{-30}{35}{#1}{#2}}
\newcommand\handhookleftarrow    [2][1]{\handxform{.50ex}{0.60ex}{-90}{ 30}{36}{#1}{#2}}
\newcommand\handstealthrightarrow[2][1]{\handxform{.50ex}{-0.2ex}{ 90}{ 80}{60}{#1}{#2}}
\newcommand\handstealthleftarrow [2][1]{\handxform{.50ex}{0.40ex}{-90}{ 80}{60}{#1}{#2}}

\newcommand\handuparrow          [2][1]{\handyform{.10ex}{-.08ex}{  0}{ -0}{91}{#1}{#2}}
\newcommand\handdownarrow        [2][1]{\handyform{.05ex}{-.00ex}{  0}{ -0}{93}{#1}{#2}}
\handnote[4]{0.3in}{4.85in}{1.3in}{blue}{I have a really short comment}
  \handline[2]{7ex} \handline[2.5]{6ex} \handline[2]{5ex}}%
\handnote[20]{6.3in}{9.55in}{1.3in}{red}{What is the meaning of life?  
  I really want to know.  Does the teacher even read this?}

\handnote[89]{.5in}{7in}{7in}{red}{Here is a test of a long vertical note!
  I am thinking it is working just great!}
\handnote[10]{6.5in}{5.8in}{2in}{blue}{\Huge The end!!!!}
\handnote[0]{2in}{6.0in}{4.9in}{red}{\LARGE{\Huge ACCENTS:}\\%
  handlines: \handline{6ex}\handline[3]{12ex}
  handrightarrows: \handrightarrow{4ex}\handrightarrow[2]{5ex}
  handleftarrows: \handleftarrow{4ex}\handleftarrow[2]{5ex}
  handhookrightarrows: \handhookrightarrow[1]{4ex}\handhookrightarrow[2.1]{7ex}
  handstealthleftarrows: \handstealthleftarrow{5ex}\handstealthleftarrow[2]{5ex}
  handstealthrightarrows: \handstealthrightarrow{5ex}\handstealthrightarrow[2]{5ex}
  handuparrows \handuparrow{2ex}\handuparrow[1.2]{4ex}
  handdownarrows \handdownarrow{2ex}\handdownarrow[1.2]{4ex}}

enter image description here

enter image description here

FYI: the Teen Spirit font table is available at http://www.tug.dk/FontCatalogue/teenspirit/teenspirit.pdf, on page 2

EDIT Note: The \handxform macro has been modified to introduce scaling/counterscaling so as to extend the range of sizes over which the \handline mandatory argument (length) may be successfully applied. The \handline macro can now be employed to make lines as long as \LARGE 47ex in length without arithmetic overflow.

  • 1
    Great answer, thanks! Is there any way to draw lines and arrows from the text to the comments or between comments? Jun 29, 2016 at 14:10
  • 1
    @Bartholomaios Not directly, but there is no reason the <content> of this call can't be a \tikzpicture that does just that. Jun 29, 2016 at 14:13
  • 1
    This is so cool. It would be perfect if each handnote could be an anchor for a tikzpicture node... But thank you, this is great! Jun 29, 2016 at 14:21
  • 2
    @Bartholomaios Unfortunately, tikz is not my speciality. Jun 29, 2016 at 14:22
  • 10
    "handnote" should be its own package on ctan! Jun 29, 2016 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.