After fleshing out (with my own project) Joseph Wright's lovely model, I've noticed that the explicit control character ^^A is used at the end of some lines. Its use appears similar to that of % to ignore trailing spaces, but I don't know why ^^A would be used instead (if this is indeed its purpose) or why % wouldn't work anyway.

  • 2
    It's the way to refer to invisible ASCII characters. Read dangerous bends (and double-dangerous bend) on page 45 of the TeXbook. Commented Jun 20, 2013 at 2:58
  • Is that file really mine? I don't recognise it (that doesn't mean it isn't mine:-) Commented Jun 20, 2013 at 8:26
  • @DavidCarlisle - mis-attribution -- It would appear to be Joseph Wright's demo DTX (I'll edit.) Commented Jun 20, 2013 at 12:13
  • @DavidCarlisle David is not the author of that file, but he's the author of the ltxdoc.cls document class which is widely used for making documentation of LaTeX source files. Commented Jun 20, 2013 at 15:05
  • @karlkoeller Probably where I made the correlation. (Am I the only one who thinks it's awesome that SE networks make it possible to have this kind of interaction?) Commented Jun 20, 2013 at 16:26

2 Answers 2


If ^ has its usual superscript meaning then ^^A is built-in primitive TeX syntax for the non-printing character control A (that is U+0001) 64 less than A. This is just an arbitrary character that Frank chose as being unlikely to be used elsewhere. The important thing about it in this context is that doc.sty does


Catcode 14 is comment (the usual catcode of %) This allows you to put comments in the documentation section of a dtx file, where % is set to catcode 9 so that it is ignored by TeX and does not make a token at all.


In .dtx files the sequence ^^A replaces the standard % to introduce comments.

.dtx files are usually processed through doc and docstrip which don't consider % a comment.

In fact, when you run latex (or pdflatex) on a such structured .dtx file, it is actually evaluated twice. The first time, only a small piece of driver code is evaluated. The second time, comments in the .dtx file are evaluated, as if there were no % preceding them.

I suggest you to read this very interesting dtx tutorial for more information.

Moreover, don't forget to take a look at the original documentation on ltxdoc, doc and docstrip.

  • 4
    Exactly how a .dtx is read when you send it to latex depends on how it's set up. It's likely that the .dtx includes a driver, but that is not required (the design of the .dtx format means it's possible to have a very simple file which can be used directly, although this is not so common).
    – Joseph Wright
    Commented Jun 20, 2013 at 6:19
  • @JosephWright What you say is right, I was trying to explain how they are designed usually. Commented Jun 20, 2013 at 8:05
  • I figured that ^^A was acting as a comment flag, I just didn't really know how or why. Thanks for the links, though! Further reading is always useful and appreciated :-) Commented Jun 20, 2013 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .