Take the 2-minute tour ×
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.

For ... complicated ... reasons (which I'll explain in a moment), I want to be able to put a literal end-of-line character in my document. Simply putting ^^J results in an Ω. Looking at the font tables in TeX by Topic, that seems quite reasonable as the slot occupied by character 10 - corresponding to the inputted eol - is, indeed, Ω. Looking further at the font tables, I can't see an eol symbol in the standard TeX fonts (why would it be there?). So I went searching in other fonts and of course they have the symbol, but I can't figure how to get it in to the document. So:

How do I get a literal end-of-line character in to a document?

(The rest isn't necessary to understand the question, just the background)

My reason for wanting this is strange, but hopefully comprehensible. I'm coercing TeX into being a pre-processor. A step in this is to use pdftotext to convert the output from TeX into an ordinary text file (suitable for feeding back into another system). Now for my desired next step, line endings seem to be significant. So I want to control where they end up. However, unless I have a sheet of (virtual) paper 20m wide, I also need to let TeX break lines where it will (since either TeX or PDF or pdftotext truncate long lines). I thought that I could get around this by using the fact that there are different systems for line-breaks on different computers, and pdftotext is nice enough to work with all of them. So I can tell pdftotext to convert the linebreaks in the PDF to, say, character 13 whilst putting character 10 where I actually want them. But that strategy hinges on being able to put some sort of actual eol character in the output, which I don't seem to be able to do.

share|improve this question
What output format are you targeting? I'm asking because one of my long term ideas is to program a DocbookXML class which outputs the XML code (but also allows normal LaTeX compilation) :-) –  Martin Scharrer Jul 22 '11 at 14:40
@Martin: I want plain-old ASCII text. This is only a step in a chain. What I want is to be able to distinguish linebreaks put in by TeX's linebreaking mechanism from linebreaks that I've declared should be there. A bit like "hard" linebreaks and "soft" linebreaks in Emacs. –  Andrew Stacey Jul 22 '11 at 14:45
You could select a very large textwidth so that TeX never breaks lines by itself. (Edit: Just read Ulrike's answer which says the same :-) ) –  Martin Scharrer Jul 22 '11 at 15:07
I have seen fonts that include an EOL character (generally, three tiny letters in a diagonal descending from the top left), but can't actually name any of them. –  TLR Jan 30 at 21:05
add comment

1 Answer

up vote 5 down vote accepted

I think you are confusing the coding of end-of-lines in a textfile with the coding of end-of-lines in a format like pdf which is orientated toward a page description. E.g. if I insert Hello\\World in a tex document the resulting pdf then contains this:

/F16 9.9626 Tf 133.768 707.125 Td [(Hello)]TJ 0 -11.955 Td [(W)80(orld)]TJ

Beside this: I doubt that you actually need a 20m sheet (assuming that your paragraphs have a normal length). When I want to copy text from pdf's and want to avoid trouble with linebreak I'm using 1m and in general that's quite enough.

share|improve this answer
I think you're probably right: it's highly likely that I'm confused! Experimenting with my current document leads to a 2m page width, so with TeX's maximum of just under 6m then I'm probably safe with that method. Thanks. –  Andrew Stacey Jul 22 '11 at 15:23
add comment

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.