# [texhax] Fwd: A few questions

Steve Revilak steve at srevilak.net
Sun May 8 16:29:39 CEST 2011

>Dear Lady/Gentleman: Would you please help me with the following.
>
>1) Suppose I have a file, named xyz.abc. In my latex source file A.tex, with
>the help of some macro, I would like to get the file name xyz.abc. For
>example, I like to read the contents of the file xyz.abc. Obviously if the
>name xyz.abc was fixed this wouldn't be neccessary. So I am changing the
>file name xyz.abc and I want A.tex to do the job without me having to change
>anything in A.tex.
>
>2) In the source file A.tex, I would like to delete a file named, say B.tex,
>that is in the same or different directory.
>
>3) In the source file A.tex, I would like to run a file named, say B.pdf,
>that is in the same or different directory.
>
>4) Can I pass the values of some variables from one source file to another,
>via some arguments?
>
>I appreciate your help. Best regards, S. N. Hosseini.

In (3), I don't understand what you mean by "I would like to run a
file named, say B.pdf".  But, I can offer a suggestion for (1), and
(4).

Here are the contents of A.tex

------------------------------------------------------------------
\documentclass{article}
\begin{document}

This is the main document

Below are the contents of \myotherfile.

\input{\myotherfile}
\end{document}
------------------------------------------------------------------

Here are the contents of xyz.abc:

------------------------------------------------------------------
This is the secondary file.

\LaTeX{} opened it as \myotherfile.
------------------------------------------------------------------

And here is a command line that runs latex on A.tex, giving xyz.abc as
the definition for \myotherfile.

pdflatex '\newcommand{\myotherfile}{xyz.abc}\input{A.tex}'

I believe this was the basic goal of (1).  xyz.abc has access to the
definition for \myotherfile, so this is also an example of (4).

Steve

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://tug.org/pipermail/texhax/attachments/20110508/d60b9315/attachment.bin>