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.

I want to completely separate formatting and content creation. The articles I will write are all plain prose that requires minimum or zero LaTeX formatting.

Also, the text file doesn't have the one-blank-line gap between paragraphs. They are separated only by one linefeed.

SUMMARY:
Is there a way to import it roughly like:

\begin{document}
  \importtextfile{my_essay.txt}
\end{document}

Can I also tell LaTeX to interpret the single linefeeds as new paragraph?

share|improve this question
add comment

1 Answer 1

up vote 18 down vote accepted

Sure. TeX inserts (by default) ^^M at the end of each line. So something like

\begingroup
\catcode`\^^M\active
\let ^^M\par%
\input{youressay.txt}%
\endgroup%

should do it, although I didn't test.

Edit: I just remembered the \obeylines macro which does exactly what I wrote above.

\begingroup
\obeylines
\input{youressay.txt}%
\endgroup%
share|improve this answer
add comment

Your Answer

 
discard

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.