Skip to content

Commit 8bc0a92

Browse files
authored
Fix traditional builder jobname handling (#1693)
If job name is specified e.g. via TEX directives, before this commit ... 1. latexmk failed to build the document with error 10. 2. logfile and created pdf documents were not found.
1 parent 493d5db commit 8bc0a92

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

latextools/make_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def worker(self, activity_indicator):
161161
cmd_coroutine.close()
162162

163163
try:
164-
log_filename = f"{self.caller.builder.base_name}.log"
164+
log_filename = f"{self.caller.builder.job_name or self.caller.builder.base_name}.log"
165165
if self.caller.builder.aux_directory_full:
166166
log_file = os.path.join(self.caller.builder.aux_directory_full, log_filename)
167167
if not os.path.exists(log_file):

plugins/builder/pdf_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def copy_assets_to_output(self) -> None:
335335
"""
336336
if self.aux_directory_full != self.output_directory_full:
337337
for ext in (".synctex.gz", ".pdf"):
338-
asset_name = self.base_name + ext
338+
asset_name = (self.job_name or self.base_name) + ext
339339

340340
dst_file = os.path.join(self.output_directory_full, asset_name)
341341
try:

plugins/builder/traditional_builder.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,22 @@ def commands(self) -> CommandGenerator:
108108
# if documents are opened and locked by viewer on Windows.
109109
cmd.append(f"-output-directory={self.aux_directory_full}")
110110

111-
if self.job_name != self.base_name:
112-
cmd.append(f'-jobname="{self.job_name}"')
113-
114111
cmd += map(lambda o: f"-latexoption={o}", self.options)
115112

113+
if self.job_name != self.base_name:
114+
cmd.append(f'-jobname={self.job_name}')
115+
116116
elif texify:
117117
# no need to output messages, if they are not consumed
118118
if logger.getEffectiveLevel() == DEBUG or self.display_log:
119119
cmd.append("--verbose")
120120
else:
121121
cmd.append("--quiet")
122122

123-
if self.job_name != self.base_name:
124-
cmd.append(f'--job-name="{self.job_name}"')
125-
126123
cmd += map(lambda o: f'--tex-option="{o}"', self.options)
127124

125+
if self.job_name != self.base_name:
126+
cmd.append(f'--job-name={self.job_name}')
127+
128128
# texify wants the .tex extension; latexmk doesn't care either way
129129
yield (cmd + [self.tex_name], f"running {cmd[0]}...")

0 commit comments

Comments
 (0)