Handwriting drill sheets
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}
% to add more line to your grid
% 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 …?
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
\par\addvspace{1\baselineskip plus 0.5\baselineskip}
% 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
% L: \the\lengthoftext\qquad N: #1\\%
% 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 ;-)
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
\def\dashfill{\cleaders\hbox to .6em{-}\hfill}
\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}
SUPPLEMENT
hashable asks two things...how to get text (rather than math) font as the lettering, and how to add the line demarking descenders. I just cobbled it together as a variant from above.
\documentclass{article}
\usepackage{scalerel}
\usepackage[usestackEOL]{stackengine}
\newlength\letterheight
\setlength\letterheight{.5in}
\def\midpitch{.6}
\def\bottompitch{.3}
\parskip 0.4in
\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
\def\dashfill{\cleaders\hbox to .6em{-}\hfill}
\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{\smash{\stackunder[\bottompitch\letterheight]{\myhline}%
{\dashline{\textwidth}}}}{\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}