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 am trying to get a tex file to read certain lines from a different text file. More precisely, in my database file $a.tex$ I have a long list. Now in a different file, I would like to have items with specific numbers. Of course, I can copy-paste. My question is, is there a way to get LaTeX to do it?

share|improve this question

2 Answers 2

The short answer is yes. The longer answer is that we'd need more information. You can easily read a file one line at a time. The e-TeX extension \readline is especially helpful for reading files.

How are these lines numbered? How many do you want to read at once? Are the lines sorted by these "specific numbers"? Is your list of numbers sorted? What else can you tell us about these lines?

share|improve this answer
    
One file is basically an itemized list. I want the first file to just copy items numbered, say, 1,2,5. So the reference will not be to a particular physical line, but rather to the first, second, and the fifth item in that list. Each one of the items may occupy more than one line as well. –  user1227 Sep 19 '10 at 9:11

Maybe the datatool package can do what you want. It can sort external files, do things like mail merging and so on.

share|improve this answer
    
Thanks. I am going to look into this. –  user1227 Sep 19 '10 at 9:15

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.