## LaTeX forum ⇒ Text Formatting ⇒ How to make a list in an external file? Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
fpires
Posts: 15
Joined: Wed Dec 23, 2015 7:10 pm

### How to make a list in an external file?

Hello, all!

It's me again. This time I have the following problem: I cannot make a list of words in an external file. I will explain it better with the following example:

\documentclass[a4paper,12pt]{report} \begin{document} Hello, world. \newwrite\temp\immediate\openout\temp=Rel\immediate\write\temp{Annex A}Some text.\immediate\write\temp{Annex B}\immediate\closeout\temp \input{Rel} \end{document}

With the above code I have the intention to make a list with the expressions Annex A and Annex B, i. e., I would like that Annex A be written in a line and Annex B be written in another line below Annex A, like this:

Annex A
Annex B

However, what I get is the two expressions written at the same line: Annex A Annex B.

There may be a way to write the two expressions in a list with the same \immediate\write command, but the question is that the information of the expression Annex B depends on what is written in Some text.. That is why I break up the code in two \immediate\write commands.

Well, sorry for the long text, and thank you again!

Felipe

Tags:

Stefan Kottwitz
Posts: 9504
Joined: Mon Mar 10, 2008 9:44 pm
Hi Felipe,

very good minimal example!

I noticed that it's written correctly to the file:

Annex A
Annex B

But a line break doesn't mean a paragraph break (or a line end) in TeX, it just means a space. For a paragraph break, you need an empty line or a \par command.

So, you could write:

\immediate\write\temp{Annex A}Some text.\immediate\write\temp{}\immediate\write\temp{Annex B}

Or:

\immediate\write\temp{Annex A\par}Some text.\immediate\write\temp{Annex B}

Stefan

fpires
Posts: 15
Joined: Wed Dec 23, 2015 7:10 pm
Stefan,

thanks again! Great solution!