LaTeX forum ⇒ GeneralChanging the output file name

LaTeX specific issues not fitting into one of the other forums of this category.
dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Changing the output file name

Postby dmt » Sun Nov 09, 2008 2:24 pm

Is there a command I can put in the .tex file that will specify the output file name when making a pdf file? (I'm using LEd and MikTex on Windows if that matters).

I'm making an exam with the exam class, and have it set up to make two version by just changing one line, one with answers, and one without answers. However, it's sort of a pain right now since they both write to the same file name, so I have to do one, then rename the file by hand then make the next one. It would be very convenient if there was a way to automate this (the exam class has a nice conditional command for when answers are printed that I could use if there was a rename output command).

User avatar
localghost
Site Moderator
Posts: 9203
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sun Nov 09, 2008 2:38 pm

You could build your final output with a special command line argument for (pdf)latex.
pdflatex -job-name=name

For further information have a look at the documentation for pdfTeX on the MiKTeX documentation page [1].

I'm not familiar with LEd. Perhaps it offers to create an own build profile similar to TeXnicCenter.

[1] pdftex


Best regards
Thorsten¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Postby dmt » Sun Nov 09, 2008 2:55 pm

I just press a button on LEd to generate the pdf ... I don't deal with command lines at all. If that is the only way to do it then it is probably easier to just keep renaming the file.

User avatar
localghost
Site Moderator
Posts: 9203
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Sun Nov 09, 2008 3:00 pm

I guess somewhere in the Configuration menu there will be the possibility to create such an additional button with this special call of the compiler. Perhaps the Help function in the program itself or the Support area on the homepage has some information about that.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

User avatar
T3.
Posts: 208
Joined: Fri Mar 14, 2008 12:58 pm

Postby T3. » Sun Nov 09, 2008 5:59 pm

dmt wrote:I just press a button on LEd to generate the pdf ... I don't deal with command lines at all. If that is the only way to do it then it is probably easier to just keep renaming the file.
If you don't like the command line approach, you can use the very first line of your master document to pass additional switches to latex:
%& -job-name=somename


Cheers,

Tomek

dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Postby dmt » Sun Nov 09, 2008 6:22 pm

Cool, that almost works. The problem is if I have to put that in the first line I don't have access to the conditional statement from the exam class.

If I put an extra % in front of the that line will it be ignored?

User avatar
T3.
Posts: 208
Joined: Fri Mar 14, 2008 12:58 pm

Postby T3. » Sun Nov 09, 2008 9:24 pm

Only the first line is searched for additional switches and only if it starts with
%&

dmt wrote:The problem is if I have to put that in the first line I don't have access to the conditional statement from the exam class.
Can you post some code (like minimal example)? I don't see why this would be a problem.

Cheers,

Tomek

dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Postby dmt » Mon Nov 10, 2008 1:21 am

Really? I haven't tried it, but i just assumed I couldn't use a conditional statement defined in the exam class before I even declared which class I was using ... I'll give it a try and see what happens. I have been just adding an extra % for now.

---

Yeah, it didn't work .... doesn't matter so much it's not a big deal to just comment or uncomment the first two lines depending on which version I'm running. Thanks.

User avatar
T3.
Posts: 208
Joined: Fri Mar 14, 2008 12:58 pm

Postby T3. » Tue Nov 11, 2008 9:09 pm

I'm afraid I don't understand what's the problem. The first line with switches is treated as a regular comment during typesetting. How does that interfere with conditionals? Could you provide some more details? Perhaps there is another way to accomplish what you want.

Cheers,

Tomek

dmt
Posts: 82
Joined: Sat Mar 15, 2008 8:13 pm

Postby dmt » Tue Nov 11, 2008 9:54 pm

I meant I wanted to put that first inside a conditional statement itself, so that whether or not it executes i dependent on another setting. This would mean only uncommenting one line to switch "states". It's not a big deal to uncomment two lines instead though.


Return to “General”

Who is online

Users browsing this forum: No registered users and 11 guests