2022 Developer Survey is open! Take survey.

Questions tagged [jobname]

This is the base name used by a TeX run to identify itself.

Filter by
Sorted by
Tagged with
1 vote
1 answer
60 views

How to extract multiple information from the \jobname

I use one .tex file to create multiple CV depending on the \jobname. For that I use the ifthen package and for each type of CV I create a Boolean value that I use to conditionally include some text. ...
user avatar
  • 13
0 votes
1 answer
43 views

tikzlibrary: external file names with spaces issue

Hello there Currently trying to implement tikz's external library to a file named stack q.tex MWE: \newcommand\subfilename{"./stack q.tex"} \documentclass{article} % pgfplots \usepackage{...
user avatar
  • 69
1 vote
1 answer
34 views

Why This Code Eliminating Index Commas Works for \jobname.mst and Not for \jobname.ist

This post is an addendum to How to Universally Remove the Comma from Each Index Entry. In the link, I was looking for a universal way to remove the comma in each index entry. Werner advised to include ...
user avatar
  • 4,959
1 vote
1 answer
71 views

TeX \ifx conditional not working for string comparison

I would like a LaTeX source file to compile in different ways depending on the job name. However, when I run pdflatex mwe with mwe.tex containing \documentclass{article} \begin{document} \ifx{mwe}\...
user avatar
  • 69
0 votes
0 answers
46 views

Print file name of \include{} in the output

How to print file name that contains word in the \include{ABC-2100011} in the PDF output? Print File name: \filename ---> Output should be Print File name: ABC-2100011 Please find MWE file as ...
user avatar
  • 809
0 votes
0 answers
35 views

How can I change PDF output name? [duplicate]

Question 1 How can we change the name of the generated pdf file, automatically on the main.tex file? Question 2 Is it possible not to change the generated files each time I change this name?
user avatar
3 votes
2 answers
835 views

Overleaf dynamic PDF filenames

I have an Overleaf project that contains multiple .tex files to create different PDF documents. If I compile one of the .tex files and download it, it is named after the Overleaf project. Currently, ...
user avatar
  • 145
1 vote
1 answer
95 views

Conditional naming of the output PDF file

My target is to have an output Solved Exam.pdf when \ifSolution is true, and The Exam.pdf when \ifSolution is false. However, I don't know if this answer is relevant here to change the \jobname and ...
user avatar
  • 8,759
1 vote
2 answers
285 views

Weird behavior of \jobname

Assume I have a file named G1 (SK).tex containing \def\SK{SK} \def\parse"#1 (#2)"{\def\language{#2}} \expandafter\parse\jobname \ifx\SK\language equal\else distinct\fi \bye When I run ...
user avatar
1 vote
1 answer
167 views

Adding a macro to the -jobname section of the PDFLaTeX compiler (i.e., how to add dates to the PDF filename)

I would like to add a macro, and/or a user-defined command, to the "jobname" section of my compilation command. My ultimate goal is to add the current date (e.g., YYYY_MM_DD) to the PDF ...
user avatar
0 votes
1 answer
167 views

How to get ride of the file extension in \currfilename

How to get ride of the file extension in \currfilename? The \jobname would only give me the name without the .tex, which is fine. But that's not what I want if I am using \input or \include. So \...
user avatar
  • 489
4 votes
1 answer
246 views

exam: Change the name of the output PDF file when answers option is enabled

If I have a document whose name is my exam.tex, is it possible to make its output PDF file have a name of my exam [solved].pdf by appending the word [solved] only when the answers class option is ...
user avatar
  • 8,759
1 vote
1 answer
51 views

Problem with testing suffix of \jobname, \c_sys_jobname_str

I have latex files with file names T-BA-DEC-de-0001_Title1.tex and T-BA-DEC-de-0002_Text2.tex. I would like to switch code depending on these file names. Up to now I tried to solve the problem using \...
user avatar
  • 297
6 votes
2 answers
287 views

Pulling numbers out of a file name

A long time ago, I wanted to solve the problem where I would typeset my homework assignments, but copy the file "hw1.tex" to make "hw2.tex", and forget to change the title "Homework 1" at the top of ...
user avatar
4 votes
1 answer
260 views

`\jobname` doesn't handle underscores properly

In this thread, @DavidCarlisle asked for an example showing that \jobname doesn't handle underscores properly. Here's an example \documentclass[11pt]{article} \begin{document} \begin{center} \...
user avatar
  • 2,069
1 vote
0 answers
48 views

How to pass jobname info to `latexmk -C`? [duplicate]

I created a Makefile which uses latexmk. Example main.tex: \documentclass{article} \begin{document} Hello World! \end{document} Makefile: FILE := FOOO .PHONY: $(FILE).pdf all: $(FILE).pdf $(...
user avatar
  • 377
1 vote
1 answer
816 views

How to write the filename on top left corner of the title page?

I tried the below-mentioned minimum working example. The difference from my earlier question on StackExchange (click here) is that we have now a title page. How to write the document's filename on ...
user avatar
  • 303
5 votes
2 answers
877 views

How to write the filename on top-left corner of each page of documentclass article

How to add the document's filename at the top left corner of each page in the following minimum working example: \documentclass{article} \begin{document} % \markboth{\jobname}{\jobname} Hello!...
user avatar
  • 303
4 votes
1 answer
402 views

Avoid quotation marks when using \jobname or \currfilename

When typesetting a file (using TeXworks on a Windows machine) which includes white spaces, then the jobname will contain the file name enclosed with double quotes. pdflatex Local\ Guide.tex will set ...
user avatar
  • 700
5 votes
1 answer
75 views

Using the document title to get the correct date

I create a lot of handouts and the like for my students using LaTeX. I find that I forget to update the date field, and so I often give out handouts with the incorrect date on the top. This is a bit ...
user avatar
  • 177
2 votes
0 answers
152 views

Specify output PDF based on latex condition

I am using the exam class and miktex for homework assignments. I regularly switch between "\noprintanswers", for the assignment, and "\printanswers", for the solution. I would love to be able to ...
user avatar
  • 171
2 votes
1 answer
252 views

MWEB: Doesn't recognise content of \jobname.bib [closed]

For another issue I have, I want to make a MWEB, but it (LaTeX/TexStudio) fails to recognise the content of the \jobname.bib. I need help to figure out, what is the problem. Here is my code for it: %...
user avatar
  • 393
3 votes
1 answer
159 views

Is there a simple way to build two pdfs from the same tex file?

I'm trying to hack together a way to generate solutions files to my quizzes and exams. Here is my current workflow. I have a file quiz.tex: \documentclass[12pt]{article} \newcommand{\solutionscolor}...
user avatar
2 votes
1 answer
56 views

varsfromjobname isn't working in a test

I am trying to give a command depending on some information in the filename. So I use gettwofromjobname in a etoolbox-test in a file named test-a.tex, but it isn't giving me the true. Any idea why? ...
user avatar
  • 171
9 votes
6 answers
912 views

How to replace characters from jobname?

I have a tex file with name Chap-Name_of_Section.tex and I running pdflatex on it. I want to set the title of my document automatically according to the file name. This could be done using \jobname. ...
user avatar
  • 1,095
5 votes
1 answer
1k views

Add date in output name

pdflatex command allows to specify an output name through --job-name= option. But can't insert the date and time automatically. Emacs could do it: (compile-command "pdflatex --job-name=myoutputname....
user avatar
  • 175
3 votes
1 answer
173 views

Condition on whether filename belongs to a list of filenames

From this site, I've learned how to condition on the name of my latex file. This code below returns the first line of the conditional iff the file is called test.tex \begin{document} \...
user avatar
  • 2,069
2 votes
1 answer
565 views

Automatically escape special characters

I have a document where I would like to put the jobname into the footer with the \jobname macro. However, if my main file has underscores in its file name, the jobname cannot be printed properly due ...
user avatar
  • 1,030
3 votes
1 answer
233 views

Get `\jobname` with normal catcodes

I would like to create a macro \myjob that has the same value as \jobname, but with letters having catcode 11 instead of 12. The goal is to be able to do something like \documentclass{article} \edef\...
user avatar
  • 19.8k
3 votes
2 answers
373 views

inside an \input file, how to determine the name "\input"ing file?

I have two tex files % file1.tex (this is the inputing file) \input file2 \bye and % file2.tex (this is the file input into file1.tex) \printTheNameOfWhateverFileInputMe What is working to show ...
user avatar
3 votes
1 answer
106 views

File Name not exactly shown

MWE \documentclass[a4paper,11pt]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage{currfile} \begin{document} %File Name: ÖüğşiÇ.tex \jobname \...
user avatar
  • 3,210
5 votes
2 answers
1k views

Defining the pdf output file within the document file using %& -job-name

My understanding is that if I create a file called noName.tex with the first line %& -jobname=myName then when I run pdflatex on that file, the output file will be named myName.pdf rather than ...
user avatar
  • 2,069
3 votes
3 answers
253 views

Generalized File Name Parsing

In Parse filename and extract revision from name, the OP wanted to parse a file name of the format cv3.01 to extract the revision number 3.01. @egreg posted the following solution for a file name ...
user avatar
  • 5,935
3 votes
2 answers
6k views

Latex (LyX) /pdftex - Change file name based on file content

When compile a LaTeX document with pdftex it usually has the name newfile.pdf. Is it possible to change the name of my document based on the content in the LaTeX source I'm about to compile ? More ...
user avatar
  • 2,207
1 vote
0 answers
155 views

Using external pdfviewer when the pdf name is changed using -job-name

I am using TexMaker and SumatraPDF for a viewer. Everything works fine. I then wanted to change the pdf name when compiling using the following command: %& -job-name=SLR-Review This placed on ...
user avatar
  • 2,511
1 vote
0 answers
204 views

Why can't I use \ifstrequal to check the \jobname? [duplicate]

I want to use the same source file to compile various target files using the -jobname option. I want to ensure that the option is not forgotten, so my approach was to check whether the \jobname is ...
user avatar
  • 2,739
12 votes
2 answers
2k views

How can I check if the filename of a LaTeX document contains a string?

I am preparing a LaTeX beamer presentation for students. I am looking for a simple way to create two versions of my presentation. One version for the Students, which just contains the text of the ...
user avatar
  • 223
13 votes
1 answer
233 views

Determine File Name and Line Number Where a Macro is Invoked From

Wondering if there is any way to print out (for debugging purposes) the file name and the line number from where a macro is invoked (not where it is defined). My attempt to use the currfile package ...
user avatar
7 votes
1 answer
3k views

Multiple PDF generation with one tex file

I'm writing my cv using moderncv, and I want to make it in 2 languages. I wrote a common part, which both languages will have, and specific ones, where I put the translated content. I also want to ...
user avatar
  • 497
3 votes
1 answer
570 views

How can i use eclipse to use the date and version in my output filename

This is less a direct LaTeX question than it is about compiling LaTeX. I am using eclipse and in my project properties i set Output File = document.pdf . My demoproject compiles and outputs the File. ...
user avatar
  • 1,489
4 votes
1 answer
431 views

The attachfile2 package doesn't work when using \jobname

I'm using MiKTeX 2.9 on a Windows 7 Home Premium 64-bit computer. I have been experimenting with using attachfile2 to make a link to an embedded LaTeX file. When I compile the following document, ...
user avatar
  • 5,336
4 votes
1 answer
348 views

Line-break \jobname

Imagine I have a file called My_very_long_document_name_that_does_not_fit_in_the_left_footer.tex Now I would like to include this long string in the left footer of my document. For this, I use \...
user avatar
  • 43
3 votes
1 answer
990 views

-job-name and BibTeX do not work together?

I have a problem using the %& -job-name= command together with the bibliography. If I compile the file without the -job-name command, the bibliography appears normally, with that command, instead,...
user avatar
  • 831
6 votes
2 answers
2k views

Timestamp in document / pdf name

Let's assume my document is called test.tex. Instead of creating a test.pdf I would like to add a suffix date stamp to the filename, e.g. test_2013_05_29 (test_yyyy_mm_dd). I am compiling with ...
user avatar
  • 401
9 votes
2 answers
936 views

How to pass \jobname with whitespace to external shell command

I need to pass \jobname to some external shell command and read back its input using the \input{|"<shell command>"} syntax. However \jobname may contain whitespaces. So how to quote it for the ...
user avatar
  • 36.4k
14 votes
1 answer
764 views

Encoding of non-ASCII characters (Umlauts) in \jobname

I need to parse \jobname to extract some metadata (such as the subject of a letter) that is encoded in the filename of the .tex file. The filenames are not restricted to ASCII, but maybe any UTF8 ...
user avatar
  • 36.4k
14 votes
1 answer
9k views

Output Filename

I'm using texmaker and PdfLaTeX. With the exception of changing the .tex filename, does anyone know how to modify the output file name based on a parameter? I am aware that the following line... %&...
user avatar
24 votes
1 answer
2k views

Can/Should I use '\jobname' to pass information from outside LaTeX?

I'm creating a parameterized document. I want to pass a string into the document from outside at 'compile time'. In particular: a comma-separated list. This list will then be used by LaTeX to resolve ...
user avatar
  • 5,876
20 votes
5 answers
8k views

Comment out lines without using % and comment enviroment

I would like to ask something which will greatly facilitate my work. But before, I introduce you to the problem I face. In my attempt to gather my notes for my students and give them something more ...
user avatar
  • 2,088
9 votes
6 answers
6k views

Automatically create two PDF output files from one tex file [duplicate]

Possible Duplicate: Can one TeX file output to multiple PDF files? Let's say I have a tex file foo.tex. Now, I want to achieve that pdflatex does not only create a file foo.pdf but simultaneously ...
user avatar
  • 7,902