It is possible to pass some parameters when compiling a myfile.tex file:
pdflatex "\some\parameters\input{myfile}"
But, if the number of parameters increase, this is not very practicable. So I'd like to store them in a file (possibly a personal package), say myparameters.sty, and load them at the compilation time. Of course:
pdflatex "\input{myparameters.sty}\input{myfile}"
doesn't work as the compiled file is myparameters.sty. But, whereas the following file (say supermyfile.tex):
\RequirePackage{myparameters}
\input{myfile}
compiles like a charm with:
pdflatex supermyfile
the following:
pdflatex "\RequirePackage{myparameters}\input{myfile}"
doesn't work as the compiled file is myparameters.sty here as well.
Hence my question: how to pass (a lot of) parameters to a file at compilation time?
pdflatex -jobname myfile "\input{myparameters.sty}\input{myfile}"– Jan 06 '14 at 18:42myparameters.styand defining the parameters based on flags that you set on the command line. For example\ifdefined\DebugMode ... \else ... \fi,\ifdefined\VerboseMode ... \else ... \fi., etc. – Peter Grill Jan 06 '14 at 18:58\input{myparameters.sty}(and that would probably be not easy to debug) but it does with\RequirePackage{myparameters}. Now, I just have to see how to include this command line in alatexmkprocess. – Denis Bitouzé Jan 06 '14 at 19:52myfile.texis a sample file using a class I'm working on and is intended 1) to be screenshots for the class doc (this involves parameters in order to extract the relevant pages, thanks tozrefpackage and this method); 2) to be compiled by users who want to try the class (and, for this, it is required to not disturb the file with strange parameters). – Denis Bitouzé Jan 06 '14 at 20:18\def\myfile{parameters}\input{file}and infiledo:\ifdefined\myfile\input{\myfile}\fi– nickpapior Jan 06 '14 at 20:23myfile.texis in.../texmf/doc/latex/myclass/sample/and, with a symlink, in.../texmf/source/latex/myclass/sample/. I want to letmyfile.texintact in.../texmf/source/latex/myclass/sample/but apply in this directory some parameters useful for the class documentation whose source is in.../texmf/source/latex/myclass/. – Denis Bitouzé Jan 06 '14 at 20:43pdflatex -jobname myfile "\RequirePackage{myparameters}\input{myfile}"in a latexmk process withlatexmk -pdf -jobname=myfile -pdflatex="pdflatex %O '\RequirePackage{myparameters}\input{%S}'" myfile.tex– Denis Bitouzé Jan 06 '14 at 20:45pdflatex supermyfileworks, place all your code inmyparameters, and on the command line say something linepdflatex "\def\ModeA{}\input{supermyfile}", and inmyparametersdefine all the conditions required forModeA, etc. I think if you provided a more detailed example of exactly what you want things might be simpler. If it is a list of pages you could define a list on the command line as well. – Peter Grill Jan 07 '14 at 03:49pdflatex -jobname myfile "\RequirePackage{myparameters}\input{myfile}". I don't know f I can answer my question myself with that answer. – Denis Bitouzé Jan 07 '14 at 14:48myfile.texfile (okay, twice, but via a symlink) is involved, and not the two filesmyfile.texandsupermyfile.tex. – Denis Bitouzé Jan 14 '14 at 08:02myfile.texand the required packagemyparameters.sty. – Peter Grill Jan 14 '14 at 18:19.texfile (the original one). – Denis Bitouzé Jan 14 '14 at 18:59.texfile and onemyparameters.styfile that had the conditionals defined for all the various settings that you desire to control form the command line. – Peter Grill Jan 14 '14 at 19:06