44

Is it possible to typeset handritten comments and annotations in the margins around a parapgaph like in this example?

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

enter image description here

70

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?

Below, I introduce

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

EDITED to introduce the following supporting emphasis markings:

\handline[<thickness-scale>]{<width>}
\handrightarrow[<thickness-scale>]{<width>}
\handleftarrow[<thickness-scale>]{<width>}
\handhookrightarrow[<thickness-scale>]{<width>}
\handhookleftarrow[<thickness-scale>]{<width>}
\handstealthrightarrow[<thickness-scale>]{<width>}
\handstealthleftarrow[<thickness-scale>]{<width>}
\handuparrow[<thickness-scale>]{<height>}
\handdownarrow[<thickness-scale>]{<height>}

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:

\documentclass{book}
\usepackage{lipsum,stackengine,scalerel,everypage,xcolor,emerald,rotating}
\usepackage[T1]{fontenc}
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
 \AddThispageHook{\smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
  \raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{#3}}}}
\newcommand\handnote[6][0]{\atxy{#2}{#3}{\rotatebox{#1}{\parbox[t]{#4}{%
  \raggedright\fontfamily{fts}\selectfont\color{#5}#6}}}}
\newcommand\handxform[7]{% SCALING IS EMPLOYED TO EXPAND THE USEFUL RANGE OF #7
  \raisebox{#1}{%
    \scalebox{4}[#6]{% THE 4X SCALING IS LATER COUNTERED BY 0.25
      \raisebox{#2}{%
        \rotatebox{#3}{%
          \stretchto{%
            \rotatebox{#4}{%
              \char#5}%
          }{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\handyform[7]{\raisebox{#1}{\scalebox{#6}[1]{%
  \rotatebox{#3}{\stretchto{\rotatebox{#4}{\raisebox{#2}{\char#5}}}{#7}}}}}
\newcommand\handuparrow          [2][1]{\handyform{.10ex}{-.08ex}{  0}{ -0}{91}{#1}{#2}}
\newcommand\handdownarrow        [2][1]{\handyform{.05ex}{-.00ex}{  0}{ -0}{93}{#1}{#2}}
\begin{document}
\pagecolor{yellow!10!orange!10}
\handnote[1]{6.3in}{1.5in}{2in}{red}{\lipsum[4]}
\handnote[4]{0.3in}{4.85in}{1.3in}{blue}{I have a really short comment}
\handnote[4]{1.3in}{4.88in}{1.3in}{blue}{\handrightarrow[1.7]{4ex}}
\handnote[0]{3.8in}{4.82in}{3in}{blue}{%
  \handline[2]{7ex} \handline[2.5]{6ex} \handline[2]{5ex}}%
\handnote[10]{6.2in}{4.8in}{3in}{blue}{\handleftarrow[2]{10ex}}%
\handnote[-75]{5.95in}{9.2in}{1.3in}{red}{\handhookleftarrow[2.1]{6ex}}
\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?}
\lipsum[1-6]
\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[2]{2.38in}{4.43in}{3in}{blue}{\handline[2]{12ex}}
%
\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}
  handhookleftarrows:\handhookleftarrow[1]{5ex}\handhookleftarrow[2.1]{9ex}
  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}}
\end{document}

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? – Bartholomaios Jun 29 '16 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. – Steven B. Segletes Jun 29 '16 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! – Bartholomaios Jun 29 '16 at 14:21
  • 2
    @Bartholomaios Unfortunately, tikz is not my speciality. – Steven B. Segletes Jun 29 '16 at 14:22
  • 10
    "handnote" should be its own package on ctan! – Bartholomaios Jun 29 '16 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.