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?
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?
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:
\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 (EDITED to account for LaTeX kernel changes on 2018.12.1):
\documentclass{book}
\usepackage{lipsum,stackengine,scalerel,xcolor,emerald,rotating}
\usepackage[T1]{fontenc}
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
\AddToHookNext{shipout/background}{\put(#1,-\dimexpr#2 ){#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]
\lipsum[5-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}
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.
<content> of this call can't be a \tikzpicture that does just that.
– Steven B. Segletes
Jun 29 '16 at 14:13
But thank you, this is great!
– Bartholomaios Jun 29 '16 at 14:21fts is the "code" for the TeenSpirit font at http://www.tug.dk/FontCatalogue/teenspirit/
– Steven B. Segletes
Jun 29 '16 at 15:15
hyperref...
– Steven B. Segletes
Jun 29 '16 at 15:32
tikzmark as in this question: http://tex.stackexchange.com/questions/295903/refer-to-a-node-in-tikz-that-will-be-defined-in-the-future-two-passes, combined with http://tex.stackexchange.com/questions/39296/simulating-hand-drawn-lines
– Rmano
Jun 29 '16 at 15:38
\fontfamily{fts}\selectfont from the \handnote macro allows it to be compiled in xelatex (but using the base font in the comments). I'd have to think further on the xelatex syntax for changing the font at that point in the code.
– Steven B. Segletes
Jul 10 '16 at 18:41
\usepackage{fontspec}, and in place of \fontfamily{fts}\selectfont replace it with, for example, \setmainfont{Calibri}. Note that all the annotation markings, will have to be revised, or also set in the Teen Spirit font.
– Steven B. Segletes
Jul 10 '16 at 18:54
\marginpar; the package marginnote gives improvement. – Willie Wong Jun 29 '16 at 13:44