Monthly Archives: October 2011

ODT/XML first aid

If you work with tex4ht to convert LaTeX to OpenDocument (for subsequent Word conversion in NeoOffice, say), you may find yourself wanting to doctor an .odt file. At least I did; sometimes tex4ht outputs an odt with problems or syntax errors. But here’s the nice thing, if you need some quick odt first aid: as I learned from this article by Maarten Wisse, an odt is really just a zip archive.

> unzip test.odt
Archive:  test.odt
   creating: META-INF/
  inflating: META-INF/manifest.xml
   creating: Pictures/
  inflating: content.xml
  inflating: meta.xml
  inflating: settings.xml
  inflating: styles.xml

Mirabile dictu, those xml files are pretty easy to read. All the good stuff is in content.xml and styles.xml. You can burrow into these files wth a text editor, modifying style parameters or the way tex4ht has tried to tag your content. And when you’re done:

> zip test.odt content.xml
updating: content.xml (deflated 81%)

That’s all! If NeoOffice gives you an error when it tries to open a generated odt, it will tell you the line number of the syntax problem, and you can just fix it by hand.

All right, I know, kludge city. But very, very useful in a pinch.

2 Comments

Filed under Conversion, kludgetastic, tex4ht, Word

Life with tex4ht: a teaser

The grand challenge for TeX loyalists in the humanities is clear: TeX/Word interoperation.

It’s been a long day of debugging, and I’m still not all the way there. But I’ll be using this space soon to post some results on using the tex4ht suite to generate an OpenDocument file (which can then be converted by NeoOffice to Word format). It can be done, even with a 200 pp book manuscript with hundreds of autogenerated footnotes and lots of Unicode text. The current maintainers of tex4ht have done amazing work on keeping it functioning in tandem with cutting-edge packages. There are lots of issues, and hopefully they’ll be making some serious updates soon, but still.

Anyway, more to come here on this subject. TeX to Word is within reach.

2 Comments

Filed under Conversion, tex4ht, Word

hyperref makes PDFs with awesome features

A PDF file can be more than just an image.

If you’ve copied text and pasted it from a PDF (or opened a JSTOR scan and discovered you couldn’t), then you know that a PDF is not just a picture for printing but a hypertext in its own right. If you use modern TeX at all, you know that pdflatex and xelatex produce well-behaved PDFs that can indeed be copied from. (In the old days, when you had to use a tex to dvi to postscript to pdf workflow, things were not so reliable.)

But you may not know that the hyperref package works in conjunction with pdf/xelatex to add extra richness to your PDFs. As you’d expect, it helps you typeset URLs and makes those URLs clickable hyperlinks. But by default, hyperref will also automatically create a set of “bookmarks” based on your section headings, respecting the chapter/section/subsection hierarchy. (These bookmarks appear as a sidebar table of contents in most PDF viewers.) Pretty nice, right?

hyperref also automatically makes footnote anchors (the numbers/symbols in your text that mark a footnote) clickable links to the footnote text itself. The hyperref documentation warns that this behavior is “easily broken” (it can be switched off with the package option hyperfootnotes=false), but I have found it to work pretty well. It can get confused if complex things happen with floats and pagebreaks.

And this is the really magical thing I discovered only a few days ago. hyperref and biblatex play well together. In particular, hyperref will make every \cite of a particular source a clickable link back to the first \cite, so that readers who see an “ibid.” or a shorthand abbreviation can click it to see the first, full reference. This works even with highly minimal cites like a postnote-only citation generated with biblatex’s \notecite and \pnotecite commands. The markup \pnotecite[16]{stevens:cpp} typesets as simply “(16),” but in the PDF that page number is a clickable link back to my first, full citations of stevens:cpp.

I haven’t yet played with generating a bibliography alongside my footnotes; it would be neat to see if hyperref and biblatex could create links between a bibliography and notes. That would alleviate my main complaint about short-citations-plus-bibliography books (I hate having to fish in the back to figure out what a telegraphically-cited source is).

Indeed, the clickable-footnote-anchor feature means that hyperref also makes PDFs that defeat my main complaint about endnotes—I hate having to turn pages / scroll all the way to the end and hunt for the note. In combination with the “back” feature of any good PDF viewer, endnotes become almost as tractable for reading as foodnotes.

Leave a Comment

Filed under Footnotes, PDF

Chicago Manual-style footnote numbers

Here’s a first tip for humanist TeXheads.

The Chicago Manual of Style calls for footnote numbers that are not superscript and followed by a period. It’s really not that obvious how to do this in LaTeX, and it was many years before I learned how. Put this in your preamble:

\makeatletter
\renewcommand\@makefntext[1]{% 
    \parindent 1em% 
    \@thefnmark.~#1}
\makeatother

See Mittlebach and Goosens’s LaTeX Companion, 112–14. Unlike the standard \@makefntext, this version does not put the footnote number in a \makebox hanging off the left margin of the footnote body. Many books also use different length rules between body and footnotes when a footnote continues from a previous page. For that, use the preamble command \usepackage[splitrule]{footmisc}. This invocation must precede the command that changes \@makefntext, or footmisc will clobber your nice formatting.

The code for altering endnotes (if you use the endnote package) is slightly different:

\renewcommand\enoteformat{\parindent 1em\theenmark.~}

On the other hand, if you use the recently developed biblatex-chicago package, your footnotes will be correctly formatted—with more or less this very command. The package also has a strict option which will suppress the rule except for footnotes continued from a previous page (the Manual’s preferred style).

Leave a Comment

Filed under Chicago Style, Footnotes

Why LaTeX and Literary Studies? An Introduction

Why blog about the LaTeX typesetting system and literary studies?

I have been using TeX for twelve years. Probably there aren’t too many people in literary studies who could say the same. I gave Word the definitive boot about six years ago and since then have produced all my written documents in LaTeX. This is a blog for humanists who are doing the same, or are thinking they might like to try.

Why might you try? I have already written one manifesto, but here’s the abbreviated version. Word has an unconscionable tyranny in literary studies and in the humanities more generally. You would think that highly verbally attentive people who write and produce elaborate documents (articles, books) for a living would have long ago risen up in protest at the many frustrations of Word: its instability, its family of mutually incompatible file formats, the sheer ugliness of the documents it produces. Try writing twenty pages with thirty footnotes in Word and look at the huge stripes of white space at the bottom of every page—if Word doesn’t crash first. Then try manipulating an extensive bibliography in Word, even with the help of Zotero. Not fun.

It doesn’t have to be that way. Switching to LaTeX involves, for a humanist, a big shift in how you go about producing documents, and even in how you think about producing documents, but the rewards are many. LaTeX doesn’t simply help you typeset pages more beautifully, though it really does that. It asks you to separate the content and the conceptual structure of your work on the one hand from the printed (or, more than ever, onscreen) page on the other. TeX’s job is to help you generate an aesthetically pleasing representation of your content from a more bare-bones representation. Work in plain text, writing markup code (yes, code—but simple code), using the immense library of tools that computer scientists and programmers and text-processing wizards have developed for themselves over the last half-century. Then produce a PDF file, and printed pages, which automatically use all the typographical bells and whistles that used to be the exclusive province of professional designers and publishers with offset presses.

Why now? I have recently finished revising a book manuscript using LaTeX, and it’s become clear to me that TeX has over the last few years taken a huge leap forward in its usefulness to humanists. It’s now possible to use Unicode text to handle multiple languages easily in a single document (and to typeset those languages responsibly, with appropriate hyphenation). Using the XeTeX engine, you can use your system fonts, including “advanced” fonts with OpenType features (small caps, ligatures, old-style numerals—you have no idea how much difference these features make in producing a document that looks typeset rather than just printed out). And above all, the biblatex project has finally provided a bibliography-management package adequate to the complicated demands of humanists. I have used the semi-miraculous biblatex-chicago package, together with the very impressive BibDesk database manager, to automatically generate the hundreds of footnotes in my book from a database of sources—and LaTeX typesets my citations in full conformity with the Chicago Manual of Style. No other combination of text processor and bibliography manager even comes close to being able to do this.

So though TeX and LaTeX have been around for decades, they are only now finally coming into their own as tools for humanists. My posts here will chronicle my work with these tools—the discoveries I’ve made, the tricks I’ve learned, the frustrations I encounter. I hope, too, that it will be a place for other humanists using TeX or working on digital document forms to discuss their shared concerns and answer each other’s (and my) questions.

6 Comments

Filed under General Reflections