TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to make writing practice sheets similar to the following.

How can you make "dotted" fonts like this?

The closest I saw on this forum was How can I convert text to paths with pdflatex? but I don't know if \pscharpath can be modified/used to do this job. Or maybe there is a TikZ solution?

Update. My plan was to position the horizontal lines using trial and error. Is there, alternatively, some way to get the correct height of a lower case and upper case letter automatically?

share|improve this question
I doubt that any automatic procedure will produce satisfactory results. Maybe you can find some existing dotted fonts in opentype format and use them with Xelatex? – Michael Palmer Feb 4 '13 at 19:54
A rather crude (albeit effective) method would be to superimpose some kind of grid made of white lines?... Or to do the whole thing with TikZ perhaps? – Count Zero Feb 4 '13 at 20:10
As a basis, you’re gonna need a font that looks like handwriting is supposed to – unless you want kids (assuming that’s the target group) to learn how to write in Compute Modern. I think there are some packages for such fonts though, and with Xe/LuaTeX, you can use any font, of course. – doncherry Feb 4 '13 at 20:29
@doncherry I found fontspace.com/kids-fonts/trace which is not terrible and works in Xelatex. You make a very good point about whether it is sufficiently like handwriting. It's not really designed for this purpose though as, for example, the spacing is proportional which isn't ideal for a writing practice sheet with different letters on it. – Raphael Feb 4 '13 at 21:06
If you have an OpenType version of your font you can try generating an outline version of your font with otftotfm. Before doing this, make sure your font licence agreement allows it. How to get a dotted version, I don't know. – Marc van Dongen Feb 7 '13 at 6:41
up vote 20 down vote accepted

Here's something that seems similar to what you're after. The macro is:

\setline{<scale factor>}{<text>}

The height of scaled upper and lower case x's in the document font are measured to draw the lines. The dotted effect comes from \pdfliteral{q 1 Tr [1 4]0 d}#2\pdfliteral{Q} where:

The pdf commands are documented in Chapter 4 of the PDF Reference

  • q saves the graphic state
  • 1 Tr traces the outline of the glyph rather than filling it
  • [1 4]0 d sets the stroke style to (pretty much) dashed 1 on 4 off starting with a dash.
  • Q means restore the graphics state to what it was

Edit: Apparently the settings above are somewhat viewer dependent. The given settings with Sumatra, give the output pictured below. To get the "same" output with Adobe Reader (at least my version) Change the line given above to:

\pdfliteral{q 1 Tr [.1 .4]0 d .1 w}#2\pdfliteral{Q}

I tried it with a bunch of fonts from The LaTeX Font Catalogue and while most worked, some didn't (in particular Calligra...not sure why). As mentioned in the comments, if you could find a suitable font then this might work for you. A couple examples of output below: enter image description here enter image description here



    \noindent\scalebox{#1}{#2}\scalebox{#1}{\pdfliteral{q 1 Tr [1 4]0 d}#2\pdfliteral{Q}}}%
    % For Adove, use this setting rather than the one above.
    %\noindent\scalebox{#1}{#2}\scalebox{#1}{\pdfliteral{q 1 Tr [.1 .4]0 d .1 w}#2\pdfliteral{Q}}}%



share|improve this answer
Is there something special required to run this. I am not quite getting the results that you are: What I get is this image. – Peter Grill Feb 6 '13 at 21:40
Hmmm, I don't think so...I just compiled with latex->pdf. I'll check after class to see if I can figure out what might be failing. – Scott H. Feb 6 '13 at 21:45
It seems that Nicola Talbot, Silex and tohecz gets the same results as I do -- Also I get identical results with TeXLive 2010, 2011 and 2012, so not sure how it worked for you. – Peter Grill Feb 6 '13 at 22:20
@ScottH. If I change [1 4] to [.1 .4] the result looks a bit better, so I suspect that it is a problem of setting some "base unit": i.stack.imgur.com/pvWf5.png – yo' Feb 6 '13 at 22:42
I think @tohecz is on to the source of the problem. Sumatra must have a different "base unit". But I know nothing about this to be able to help you -- it looked interesting so that is why I started to try your example. – Peter Grill Feb 7 '13 at 0:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.