# Handwriting drill sheets

I am looking to create some handwriting drill sheets. Similar to what can be found here http://www.handwritingworksheets.com/flash/cursive/paragraph/index.html

I also found this question: Writing practice sheets - dotted letters But I'd like to be able to simply write a paragraph of text with a known font and have the lines placed behind, perhaps like a watermark.

I have found a git repo with some nice lines in both portrait and landscape here https://github.com/gkthiruvathukal/kindergarten

From the kindergarten example, I would like to overlay "phantom" text (probably a dotted cursive font) over the lines that are generated. Any thoughts?

\documentclass[10pt,letterpaper]{article}

\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=1cm,rmargin=1cm}
\pagestyle{empty}
\usepackage{dashrule}
\usepackage{forloop}
\makeatother

\setlength{\parindent}{0pt}

\begin{document}

\newcounter{ct}
\forloop{ct}{1}{\value{ct} < 13}
{
\vskip 10pt
\rule[1.75ex]{7.5in}{1pt}
\\
\hdashrule{7.75in}{1pt}{4mm}
\\
\rule[-1.75ex]{7.5in}{1pt}
\\
}

\vskip 1cm

\end{document}


*Edit: I also just found this source: http://failuresandfixes.blogspot.com/2011/12/faking-baseline-grid-in-latex.html

So some combination of these makes sense to me, I'm just not clear on how...

*Edit: Okay, So I've gotten pretty far here. But it seems like several parameters need to be functions of each other some how. The line spacing, the font size, etc. Here is where I am:

\documentclass[10pt,letterpaper,english]{article}

\usepackage{babel}
\usepackage{blindtext}

\usepackage{setspace}

\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=1cm,rmargin=1cm}
\pagestyle{empty}
\usepackage{dashrule}
\usepackage{forloop}
\makeatother

\usepackage{xcolor}

\newcommand{\baselinegrid}{%
\raisebox{0pt}[\height][0pt]{\makebox[0pt][l]{%
\begin{minipage}[t]{\textwidth}%
\begin{color}{red}%
\newcounter{ct}
\forloop{ct}{1}{\value{ct} < 11}
{
%\vskip 15pt
\rule[0.5ex]{7.5in}{1pt}
\\
\hdashrule[0.75ex]{7.75in}{1pt}{4mm}
\\
\rule[1.2ex]{7.5in}{1pt}
\\
}
\end{color}
\end{minipage}%
}}}

\begin{document}

\baselinegrid%

\begin{spacing}{2.5}

\usefont{T1}{wela}{m}{n}
\fontsize{30}{15}\selectfont
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}

DURING the whole of a dull, dark, and soundless day in the autumn of the year, when the clouds hung oppressively low in the heavens, I had been passing alone, on horseback, through a singularly dreary tract of country; and at length found myself, as the shades of the evening drew on, within view of the melancholy House of Usher.

\end{spacing}

\end{document}


Here is another solution, without the need of calculating the line number and the possibility to span text over several pages. I used the lineno to have “every line” hook and then I redefine the line numbers to be the grid instead of the actual number.

\documentclass[12pt]{article}

% necessary packages
\usepackage{tikz}

% set the font
%\usepackage{fontspec}
%\setmainfont{Zapfino}

% increase baseline skip
\usepackage{setspace}
\setstretch{1.5}

% define height of lowercase letters
\newcommand{\lowercaseheight}{1ex}
% define height of uppercase letters
\newcommand{\uppercaseheight}{2ex}
% define depth of descenders
\newcommand{\descenderdepth}{-0.5ex}
% you may add more values here and then use them in the {tikzpicture}

% package to have a "every line" hook
\usepackage{lineno}

\newenvironment{drillsheet}{%
% let the "line numbers" start directly at the text
\setlength\linenumbersep{0pt}%
% let the "line numbers" be the grid
\renewcommand{\thelinenumber}{%
\begin{tikzpicture}[overlay]
% baseline
\draw ((0,0) -- ++(\textwidth,0);
% lowercase height
\draw [ultra thin] ((0,\lowercaseheight) -- ++(\textwidth,0);
% uppercase height
\draw (0,\uppercaseheight) -- ++(\textwidth,0);
% descender depth
\draw [ultra thin] (0,\descenderdepth) -- ++(\textwidth,0);
\end{tikzpicture}%
}%
% the font and color of the numbers must be set explicitly
\renewcommand\linenumberfont{\normalfont\color{black}}
% start "line numbering", i.e. the grid
\begin{linenumbers}%
% set text color to gray
\color{black!25}%
}{
% end "numbering", i.e. the grid
\end{linenumbers}%
}

\newenvironment{fakedisplaymath}{%
\begin{center}%
$\displaystyle }{%$%
\end{center}%
}

\begin{document}
\Large
\begin{drillsheet}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed $a^2+b^2=c^2$
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
\begin{fakedisplaymath}
A=\int_0^2f(x)\,dx
\end{fakedisplaymath}
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
\end{drillsheet}
\end{document}


Math
Inline math works as expected:

But displaystyle math is a little harder, since lineno ignores display math. I added the {fakedisplaymath} environment to add rudimentary support for equations.

But I’d say it's hard to draw the drill line for math, how about fractions for instance …?

• This worked really well and is robust to changes in font. Well done, and thank you so much. This is a really cleaver solution. – randomlogic78 Oct 25 '13 at 13:41
• I have the full texlive installed and it can't find your font, is there a special package just for the font used? – MaoYiyi Nov 21 '13 at 10:56
• @MaoYiyi: The font is commercial and not part of any TeX distribution, though. But it is part of some operating systems (as Mac OS X). You can buy it from Linotype for example. Or have a look at fontsquirrel.com to find free alternatives … – Tobi Nov 21 '13 at 14:55
• Furthermore you must compile the example with either XeTeX or LauTeX, since the fontspec package requires on of these machines. – Tobi Nov 21 '13 at 14:56
• is there a way to do this with with mathmode? – MaoYiyi Nov 22 '13 at 1:54

I guess you cant make a font dotted with LaTeX you either have to use a font which is designed as dotted or stick to a font with streight lines. I suggest using a light gray instead of dotting the font. The grid can be added with TikZ, for instance.

If you use XeTeX or LuaTeX you can use fontspec and load every font installed on your system. Otherwise a list of (PDF)LaTeX compatible fonts can be found at the LaTeX Font Catalouge.

\documentclass[12pt]{article}

% necessary packages
\usepackage{environ}
\usepackage{tikz}
\usetikzlibrary{calc}

% set the font
\usepackage{fontspec}
\setmainfont{Lilly}% from http://www.fontsquirrel.com/

% help length to store width of text
\newlength{\lengthoftext}

% increase baseline skip
\usepackage{setspace}
\setstretch{2}

% define height of lowercase letters
\newcommand{\lowercaseheight}{1ex}
% define height of uppercase letters
\newcommand{\uppercaseheight}{1.7ex}
% define depth of descenders
\newcommand{\descenderdepth}{-0.8ex}

% set up the environment. Use the optional argument to give a line number
% if it's not calculated properly
\NewEnviron{drillpar}[1][\numberoflines]{%
% start new paragraph and add some space
% measure the length of the text as if it's in a single line
\settowidth{\lengthoftext}{\BODY}%
% divide by text width to get the number of lines
\pgfmathtruncatemacro\numberoflines{int(\lengthoftext/\textwidth)+1}%
% use a {minipage} to keep the text on the same page
\begin{minipage}{\textwidth}
% for debugging
% set an anchor for the grid
\tikz[remember picture,overlay] \coordinate (grid anchor);%
% print the text
{\color{black!25}\BODY}
% draw the baseline grid
\begin{tikzpicture}[remember picture,overlay]
\foreach \line in {1,...,#1} {
% baseline
\draw [ultra thick] ($(grid anchor)+(0,{-(\line-1)*\baselineskip})$) --
++(\textwidth,0);
% lowercase height
\draw ($(grid anchor)+(0,{-(\line-1)*\baselineskip+\lowercaseheight})$) --
++(\textwidth,0);
% uppercase height
\draw [thick] ($(grid anchor)+(0,{-(\line-1)*\baselineskip+\uppercaseheight})$) --
++(\textwidth,0);
% descender depth
\draw ($(grid anchor)+(0,{-(\line-1)*\baselineskip+\descenderdepth})$) --
++(\textwidth,0);
}
\end{tikzpicture}%
\end{minipage}%
% start new paragraph and add some space
\par\vspace{1\baselineskip plus 0.5\baselineskip}
}

\begin{document}
\Large
\begin{drillpar}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
\end{drillpar}
\end{document}


Compile this example with XeTeX twice (otherwise the grid won’t be placed correctly). To produce an empty grid use an empty environment and set the number of lines with the optional argument, e.g.

\begin{drillpar}[6]
\end{drillpar}


You may change the line width of the grid by changing the options of the \draw commands, see the pgfmanual for more information or ask in a comment ;-)

• So I tried this with two different fonts on my system, Zapfino, and Brush Script MT, and both died horrible deaths. If you have those fonts installed you should see something similar. Was I supposed to change something else when I changed the font? – randomlogic78 Oct 25 '13 at 4:28
• So I found a font that did work (Snell Roundhand), but when I added text that exceeded the page length, the document compiles with errors, and doesn't move text to the next page. – randomlogic78 Oct 25 '13 at 4:36
• Is this somehow applicable to making it multi-page: tex.stackexchange.com/questions/21236/… – randomlogic78 Oct 25 '13 at 4:53
• The problem with Zapfino is that it won’t fit in the baseline and for that the \baselineskip and the real baseline skip in the document aren’t congruent. But you can increase by changing the factor in \setstretch{f}, e.g. to 4. Furthermor you might have to change the values of \lowercaseheight, \uppercaseheight, and \descenderdepth. – Tobi Oct 25 '13 at 9:26
• At the moment it is impossible to let the text span multiple lines, but I’ll see what I can do … – Tobi Oct 25 '13 at 9:27

Here, each issuance of \blankrow puts a new row on the paper, while \fillrow allows you to specify italic (actually math) text. The distance between top and baseline is set with length \letterheight, the fractional height to the midline is specified in \midpitch (corresponding to the font for which you wish to develop the practice sheet), while the gap between adjacent rows is set with \parskip. I also assumed the height of capitals was 0.85 the height of the \strutbox, though that number can be changed.

If you want roman text, place the \smash{#1} between dollar signs as in $\smash{#1}$, in the definition of \fillrow.

\documentclass{article}
\usepackage{scalerel}
\usepackage[usestackEOL]{stackengine}
\newlength\letterheight
\setlength\letterheight{.5in}
\def\midpitch{.6}
\parskip 0.3in
\def\stacktype{L}\def\stackalignment{l}
%From morsburg at http://tex.stackexchange.com/questions/12537/
%how-can-i-make-a-horizontal-dashed-line/12553#12553
\newcommand\dashline[1]{\abovebaseline[-2pt]{\hbox to #1{\dashfill\hfil}}}
\def\myhline{\rule{\textwidth}{.3pt}}
\newcommand\blankrow{%
\setstackgap{L}{\the\letterheight}%
\stackon[\midpitch\letterheight]{%
\stackon{\myhline}{\myhline}}{\dashline{\textwidth}}%
}
\newcommand\fillrow[1]{%
\stackinset{l}{}{b}{}%
{\scalerel*{\rule{0pt}{.85\ht\strutbox}\smash{#1}}{\blankrow}}{\blankrow}}
\begin{document}
\fillrow{ABC abc}

\fillrow{GHIJ ghij}

\blankrow
\end{document}


• So the problem here is that I have to do the rows individually instead of just typing a paragraph. Tobi's response is much more in the spirit of what I'm looking for. Can this be done as a multi-row (read, unknown number of rows)? – randomlogic78 Oct 25 '13 at 4:30
• @randomlogic78 I'll continue to think about it, but no easy way comes to mind on how to make it continuous. – Steven B. Segletes Oct 25 '13 at 11:03