How can I dynamically import a tex file?
I essentially have hundreds of .tex files in one folder, all of these files have multiple versions. I can't move them out of this folder.
Ex:
ver1file1.tex
ver2file1.tex
...
ver8file1.tex
...
ver8file100.tex
I want to be able to set a environment variable or pass a command line argument so that latex will be able to dynamically load all the files from a particular version.
Example:
pdflatex ver1
or
EXPORT LATEX_VER=ver1
to have only the following being imported in the main latex file.
ver1file1
ver1file2
...
ver1file100
Below is an example of what i've tried so far but I can't get the I basically want to have 2 .tex files, file1.tex and file2.tex . I want to be able to accept a command line argument that defines the name of the file to import.
main.tex
\import{c:\path}{aux}
\import{c:\path}{\dynavar} % should load variable from commandline + added string ex: ver1file1
aux.tex
%accept a command line argument
\ifdefined\myflag
\newcommand\dynavar[1]{\emph{#1}}
\else
\newcommand\dynavar[1]{defaultval}
\fi
\expandafter\def\expandafter\dynavar\expandafter{\dynavar { }file1}

pdflatex \def\dynavar{abc} \input{file}to have\dynavaraccessible insidefile.tex. I'm not sure I understand the usage offile1.texandfile2.texand how it fits in with your command-line request/approach. – Werner Mar 21 '14 at 04:11