share
TeX - LaTeXHandwritten font with math support
[+54] [4] Paulo Cereda
[2011-09-13 16:31:18]
[ fonts ]
[ https://tex.stackexchange.com/questions/28340/handwritten-font-with-math-support ]

Friends, I've been looking for a handwritten font with math support. In The LaTeX Font Catalogue [1], there are great handwritten fonts available, but unfortunately I could not find one with proper math support.

I'm aware that the general rule is to use a proper math font instead, say mathpazo. But in this very peculiar case - a beamer template I'm writing for one keynote of mine - a handwritten font would perfectly fit.

I found some references in a comp.text.tex thread [2] and also in the LaTeX Community Forum [3] - the latter with an interesting approach provided by frabjous [4].

Since both entries are dated January 2010, I'd like to know if there is any new light on this subject - a new font, a new technique, etc.

Or I could collect some detexify samples and put all together in a math font. =P (just kidding!)


Update: Since I have such great answers to my question, I'll add a bounty. My plan is to accept one answer while awarding the other one with a bounty.

(2) I like the detexify idea. - topskip
(3) urwchancal uses Zapf Chancery for math. But Zapf Chancery is a proper calligraphic font, not in the "casual handwriting" style. - Andrey Vihrov
@Andrey: This font looks very promising! In case I don't find a more "casual handwriting" font, I'll probably give this one a try. - Paulo Cereda
[+23] [2011-09-13 17:10:59] Aditya [ACCEPTED]

You can try AMS Euler font (or the Neo Euler opentype). It is an upright font that was designed to resemble mathematics written on a blackboard.

I think that, for presentations, Euler combines well with GFS Artemisia, but the latter is not a handwriting font.

EDIT: If you do decide to use the Euler font, you can get the math support with \usepackage{euscript} [1]. Then you can write, for example: $\EuScript{C}$ to get a nice round letter C.

[1] http://www.maths.usyd.edu.au/u/SMS/texdoc/euscript.pdf

Thanks a lot, Aditya! The euler font really matches my presentation nicely. - Paulo Cereda
(15) How about an example? - Faheem Mitha
1
[+23] [2011-09-13 18:28:21] mas

As Andrey mentioned in his comment there are 'calligraphic' fonts such as Zapf Chancery and Euler. As another example there are the non-free, chargeable, Math Script and Math Curly as part of the full mtpro2 family [1]. An trivial example using both of these and the normal mtpro2 font is:

\documentclass{article}
\usepackage[mtpccal,mtpscr]{mtpro2}
\newcommand\scrsin{s\kern-.17em i\kern-.12em n}
\begin{document}
\[ \mathscr{{d f(x)\over dx} = {d \scrsin(x) \over dx} = \cos(x)} \]

\[ \mathcal{{d f(x)\over dx} = {d \scrsin(x) \over dx} = \cos(x)} \]

\[{d f(x)\over dx} ={d \sin x \over dx} = \cos x \]
\end{document}

This also demonstrates some of the issues with simulated handwriting:

  • standard maths operators may not look handwritten; compare the quick replacement for \sin, \scrsin, compared with \cos above.

  • except for expert calligraphic writers, a handwritten text is not perfectly even (i.e. every occurence of a given letterform is the same).

  • the shapes of handwritten letters may vary depending on their neighbours. Some handwriting fonts do support alternate letterforms (e.g. 'r' and 'z' in mtpro2's Math Curly and Math Script) but not usually a full range to simulate handwriting.

  • except perhaps on lined paper, the baseline and rules for handwritten maths are not as straight in a handwritten version.

  • a handwriting font is not, in general, as legible as a good 'standard' font. For limited use (e.g. the usual maths use as a script or calligraphic variable) this is not usually critical but for wider use, especially when projected, then questions of readability at distance and legibility (including for those with less than perfect eyesight) when compared to the more usual fonts need to be considered. This may limit their use for projected material, except perhaps for novelty use or for unimportant content?

[1] http://www.pctex.com/mtpro2.html

Thanks mas, your answer is pretty nice and has a great insight! Please wait a few hours, I'll award you with the bounty. - Paulo Cereda
@mas, Do you know how to make the cursive font the default one (so there is no need to use \mathcal or \mathscr? - alfC
2
[+21] [2011-09-16 13:17:34] Jim Hefferon

You describe this as a "peculiar" circumstance. I have also been on the lookout for a handwritten math font. I've long admired the look of the Physics texts that belonged to my father, from the middle of the 1900's. I particularly like the inked illustrations and I'd love to merge the precision of today's computer-drawn illustrations with the elegance that I see in some of these. If someone has a suggestion in this direction I'd be glad to hear that (the handLaTeX is one I was unaware of). Here is an example from Morse's Vibration and Sound with more than the usual amount of text.

Morse's Vibration and Sound, 1948, p 8


(6) it looks so beautiful! That's exactly my feeling on a great handwritten math font. Sometimes we tend to imagine a handwritten font as poorly drawn, but a good handwritten font is actually very pleasant to the eye. :-) - Paulo Cereda
So how to realize this in Beamer? - Αλέξανδρος Ζεγγ
Can you please share the code? - Anonymous
If you are asking about the illustration, it is a scan. - Jim Hefferon
3
[+17] [2011-09-16 11:53:43] Paulo Cereda

For completeness sake, I'm adding another suggestions to the handwritten font issue:


1st suggestion: load a "normal" handwritten font and set the math font to it.

That's frabjous [1]' original suggestion in the LaTeX Community Forum [2]. The idea is to use a proper engine to load a "normal" handwritten font and set the math font to it. This approach will only replace the numbers, not the operators set, but it might work for some simple cases.


2nd suggestion: DIY handwritten font.

It started as a joke, but one might really consider to come up with a DIY - do it yourself - handwritten font.

Info (In fact, I'm actually planning this and once I have something significant to show, I'll edit this question and provide a link to the correct font repository - probably GitHub)

My ideas:

  1. Draw every single glyph known to mankind in your favorite editor (e.g., Inkscape [3]) or draw them in a paper, scan and then trace to vector with a proper converter (e.g., Potrace [4]).

  2. Read Create a symbol font from SVG symbols [5] and follow the instructions of how to use FontForge [6] to generate your new font.


3rd suggestion: Warning untested! Warning use euler font with some spice in it.

I found a project called handlatex [7] hosted on Google Code. It seems to have a package and a program. This is the new link that uses Python 3: https://github.com/DavideFauri/handlatex According to the manual:

The hand package is the LaTeX interface to the special-purpose handlatex frontend. It provides a simple environment, \handpar, that can be used to inject seemingly random variations in placement, interlining and orientation of paragraphs, as well as visual word shifting. Combined with appropriate fonts, it reasonably mimics the typical rendering of a sloppy handwritten text on delinated paper.

You can take a look on the sample .tex file available here [8]:

\documentclass{article}

% Sample demo document for handLatex using TeX Live' xelatex driver.

\usepackage[xetex,
  bookmarks=false,
  pdftitle={handLaTeX demo}]{hyperref}
\usepackage{fontspec}

\usepackage[driver=xelatex,
  lowwordangle=-3,
  highwordangle=3,
]{hand}
\usepackage{amssymb}

\begin{document}
\thispagestyle{empty}

\section*{\texttt{hand}\LaTeX\ Demo}
%\fontspec{Fountain Pen Frenzy} % If you have any good font, include it here.

\vfill

\begin{handpar}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis ut libero et arcu
interdum varius. Nam bibendum, mi sed consequat malesuada, nunc diam condimentum
massa, sit amet egestas nibh ligula sit amet dui. Vestibulum eu urna. Etiam
vestibulum. Aenean nisi nulla, fringilla at, laoreet eu, iaculis id,
diam. Mauris aliquet vehicula lacus. Maecenas id nisl ac justo sodales
dictum. Phasellus eget eros. In hac habitasse platea dictumst. Nam ut tortor
vitae dui mollis egestas. Nullam sagittis libero quis nibh. Donec aliquam. Donec
tincidunt. Aliquam eget nisl. Suspendisse mollis pellentesque nunc.
\end{handpar}

...

The output:

HandLaTeX

I'd like to see what effects can be achieved with this package/frontend when using euler. I'll experiment this later. By the way, I didn't find any references to math when reading the hand manual, so I'm not sure how it behaves.

[1] https://tex.stackexchange.com/users/411/frabjous
[2] http://www.latex-community.org/forum/viewtopic.php?f=48&t=7383
[3] http://inkscape.org/
[4] http://potrace.sourceforge.net/
[5] https://tex.stackexchange.com/questions/22487/create-a-symbol-font-from-svg-symbols
[6] http://fontforge.sourceforge.net/
[7] http://code.google.com/p/handlatex/
[8] http://handlatex.googlecode.com/svn/trunk/sample.tex

(1) Did you ever manage to trace your hand-writing? - Johannes_B
4