GeneralCreate text file during compile?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
stringkarma
Posts: 7
Joined: Tue Jun 23, 2009 10:59 pm

Create text file during compile?

Post by stringkarma »

Hello all, my first post here.

I have been very happy with Beamer and have started to use it for all of my presentations. I have found an excellent viewer called Impressive for viewing the presentation. Now I am getting a little tired of making the .info file that tells impressive what slide transitions to use and which slides to omit from the overview.

To attempt to fix this I want to make a package that can be used to generate the .info file (which is just an ascii text file) during compile time. It seems that all I need is some LaTeX command which can write to a file (analogous to >> in bash). It seems that some functionality must exist as aux and out files are produced.

I have seen the \typeout command but how could this be used to send to a file rather than the terminal?

Thanks for any help on this or any other thoughts on my Impressive package.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Create text file during compile?

Post by frabjous »

I've never tried this, but the following topic may provide some help:
http://www.latex-community.org/forum/vi ... f=5&t=1046
PGScooter
Posts: 31
Joined: Mon Jul 14, 2008 2:47 pm

Re: Create text file during compile?

Post by PGScooter »

how do you compile your latex files?

If you do it from the commandline, then you could just write a bashscript with two lines-- one which compiles the latex files and one which writes your desired output.

I'm guessing you would have thought of this if you do it from the command line, but I find myself missing easy solutions so I thought I would still post.

Another alternative might be to use perltex.
stringkarma
Posts: 7
Joined: Tue Jun 23, 2009 10:59 pm

Re: Create text file during compile?

Post by stringkarma »

perltex is an interesting thought
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Create text file during compile?

Post by josephwright »

This is all done using low-level TeX commands. You need to create a new write:

Code: Select all

\newwrite\mywrite
then open it for output

Code: Select all

\edef\mywritename{\jobname.info}
\immediate\openout\mywrite\mywritename
then write to the file

Code: Select all

\immediate\write\mywrite{<balanced text>}
Inside the write, you can create a new line with ^^J. The text is written expanded by TeX, so you also need to watch that. If you want to write any "fragile" commands, consider looking at the LaTeX \protected@write macro.
Joseph Wright
Post Reply