I can't write on file 'foo.aux' Announcing the arrival of Valued Associate #679: Cesar...
Can the prologue be the backstory of your main character?
Estimate capacitor parameters
What would be Julian Assange's expected punishment, on the current English criminal law?
What items from the Roman-age tech-level could be used to deter all creatures from entering a small area?
How can players take actions together that are impossible otherwise?
Stars Make Stars
Single author papers against my advisor's will?
Stop battery usage [Ubuntu 18]
How to rotate it perfectly?
Antler Helmet: Can it work?
What LEGO pieces have "real-world" functionality?
Mortgage adviser recommends a longer term than necessary combined with overpayments
If A makes B more likely then B makes A more likely"
Who can trigger ship-wide alerts in Star Trek?
What is the electric potential inside a point charge?
If I can make up priors, why can't I make up posteriors?
Did the new image of black hole confirm the general theory of relativity?
Strange behaviour of Check
Can a monk deflect thrown melee weapons?
Problem when applying foreach loop
Using "nakedly" instead of "with nothing on"
Notation for two qubit composite product state
What is the largest species of polychaete?
Geometric mean and geometric standard deviation
I can't write on file 'foo.aux'
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Where to find official (!) and extended documentation for tex/latex's commandline options (especially -interaction modes)?Avoid linebreaks in LaTeX console / log output (or increase columns in terminal)LaTeX error: can't write fileMiKTeX can't write on pdf fileI can't find file “gbsnuf9”MiKTeX’s LuaLaTeX and minitoc: “I can't write on file …mtc”Fatal error, "Can't write on file 'test.pdf'Error: 'I can't write on file 'Main.pdf'“I can't write on file”I can't write on file `elsarticle-template.spl'Output-directory can't write on file log, linux terminal“! I can't write on file 'thesis.dvi'” error
I am getting an error when compiling this template with pdflatex -output-directory=./_out thesis.tex
:
! I can't write on file `text/abbreviations.aux'.
@include ...immediate openout @partaux #1.aux
immediate write @partau...
l.187 include{text/abbreviations}
(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name: ^D
! Emergency stop.
@include ...immediate openout @partaux #1.aux
immediate write @partau...
l.187 include{text/abbreviations}
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on _out/thesis.log.
This is usually the way that I use the -output-directory
option, and I have never had a problem with that usage before, but I must be doing something wrong because the compiling works fine without this option.
File Tree
Result of ls -R
from the project root:
_README.txt _out figures ociamthesis.cls references.bib splitcolor.py text thesis.tex
./_out:
thesis.aux thesis.bcf thesis.lof thesis.mtc thesis.out
thesis.bbl thesis.blg thesis.log thesis.mtc0 thesis.toc
./figures:
beltcrest.pdf sample
./figures/sample:
Gray498.png
./text:
abbreviations.tex abstract.tex acknowledgements.tex appendix-1.tex ch1-intro.tex ch2-litreview.tex
Version
I am on OSX and the manual for pdflatex doesn't show any option -aux_directory
, my version is:
pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015)
kpathsea version 6.2.1
Copyright 2015 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.6.17; using libpng 1.6.17
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with xpdf version 3.04
errors output
add a comment |
I am getting an error when compiling this template with pdflatex -output-directory=./_out thesis.tex
:
! I can't write on file `text/abbreviations.aux'.
@include ...immediate openout @partaux #1.aux
immediate write @partau...
l.187 include{text/abbreviations}
(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name: ^D
! Emergency stop.
@include ...immediate openout @partaux #1.aux
immediate write @partau...
l.187 include{text/abbreviations}
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on _out/thesis.log.
This is usually the way that I use the -output-directory
option, and I have never had a problem with that usage before, but I must be doing something wrong because the compiling works fine without this option.
File Tree
Result of ls -R
from the project root:
_README.txt _out figures ociamthesis.cls references.bib splitcolor.py text thesis.tex
./_out:
thesis.aux thesis.bcf thesis.lof thesis.mtc thesis.out
thesis.bbl thesis.blg thesis.log thesis.mtc0 thesis.toc
./figures:
beltcrest.pdf sample
./figures/sample:
Gray498.png
./text:
abbreviations.tex abstract.tex acknowledgements.tex appendix-1.tex ch1-intro.tex ch2-litreview.tex
Version
I am on OSX and the manual for pdflatex doesn't show any option -aux_directory
, my version is:
pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015)
kpathsea version 6.2.1
Copyright 2015 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.6.17; using libpng 1.6.17
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with xpdf version 3.04
errors output
3
I think you'd need (at least) a text subdirectory of_out
but it's always simpler not to use--output-directory
which greatly complicates the processing model and provides no features.
– David Carlisle
Aug 8 '16 at 10:59
You are right, it was just a matter of creating a subfolder_out/text
, sorry for that silly question!
– Sheljohn
Aug 8 '16 at 11:14
add a comment |
I am getting an error when compiling this template with pdflatex -output-directory=./_out thesis.tex
:
! I can't write on file `text/abbreviations.aux'.
@include ...immediate openout @partaux #1.aux
immediate write @partau...
l.187 include{text/abbreviations}
(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name: ^D
! Emergency stop.
@include ...immediate openout @partaux #1.aux
immediate write @partau...
l.187 include{text/abbreviations}
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on _out/thesis.log.
This is usually the way that I use the -output-directory
option, and I have never had a problem with that usage before, but I must be doing something wrong because the compiling works fine without this option.
File Tree
Result of ls -R
from the project root:
_README.txt _out figures ociamthesis.cls references.bib splitcolor.py text thesis.tex
./_out:
thesis.aux thesis.bcf thesis.lof thesis.mtc thesis.out
thesis.bbl thesis.blg thesis.log thesis.mtc0 thesis.toc
./figures:
beltcrest.pdf sample
./figures/sample:
Gray498.png
./text:
abbreviations.tex abstract.tex acknowledgements.tex appendix-1.tex ch1-intro.tex ch2-litreview.tex
Version
I am on OSX and the manual for pdflatex doesn't show any option -aux_directory
, my version is:
pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015)
kpathsea version 6.2.1
Copyright 2015 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.6.17; using libpng 1.6.17
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with xpdf version 3.04
errors output
I am getting an error when compiling this template with pdflatex -output-directory=./_out thesis.tex
:
! I can't write on file `text/abbreviations.aux'.
@include ...immediate openout @partaux #1.aux
immediate write @partau...
l.187 include{text/abbreviations}
(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name: ^D
! Emergency stop.
@include ...immediate openout @partaux #1.aux
immediate write @partau...
l.187 include{text/abbreviations}
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on _out/thesis.log.
This is usually the way that I use the -output-directory
option, and I have never had a problem with that usage before, but I must be doing something wrong because the compiling works fine without this option.
File Tree
Result of ls -R
from the project root:
_README.txt _out figures ociamthesis.cls references.bib splitcolor.py text thesis.tex
./_out:
thesis.aux thesis.bcf thesis.lof thesis.mtc thesis.out
thesis.bbl thesis.blg thesis.log thesis.mtc0 thesis.toc
./figures:
beltcrest.pdf sample
./figures/sample:
Gray498.png
./text:
abbreviations.tex abstract.tex acknowledgements.tex appendix-1.tex ch1-intro.tex ch2-litreview.tex
Version
I am on OSX and the manual for pdflatex doesn't show any option -aux_directory
, my version is:
pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015)
kpathsea version 6.2.1
Copyright 2015 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.6.17; using libpng 1.6.17
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with xpdf version 3.04
errors output
errors output
edited Aug 14 '16 at 8:29
Johannes_B
21.1k352206
21.1k352206
asked Aug 8 '16 at 10:54
SheljohnSheljohn
448418
448418
3
I think you'd need (at least) a text subdirectory of_out
but it's always simpler not to use--output-directory
which greatly complicates the processing model and provides no features.
– David Carlisle
Aug 8 '16 at 10:59
You are right, it was just a matter of creating a subfolder_out/text
, sorry for that silly question!
– Sheljohn
Aug 8 '16 at 11:14
add a comment |
3
I think you'd need (at least) a text subdirectory of_out
but it's always simpler not to use--output-directory
which greatly complicates the processing model and provides no features.
– David Carlisle
Aug 8 '16 at 10:59
You are right, it was just a matter of creating a subfolder_out/text
, sorry for that silly question!
– Sheljohn
Aug 8 '16 at 11:14
3
3
I think you'd need (at least) a text subdirectory of
_out
but it's always simpler not to use --output-directory
which greatly complicates the processing model and provides no features.– David Carlisle
Aug 8 '16 at 10:59
I think you'd need (at least) a text subdirectory of
_out
but it's always simpler not to use --output-directory
which greatly complicates the processing model and provides no features.– David Carlisle
Aug 8 '16 at 10:59
You are right, it was just a matter of creating a subfolder
_out/text
, sorry for that silly question!– Sheljohn
Aug 8 '16 at 11:14
You are right, it was just a matter of creating a subfolder
_out/text
, sorry for that silly question!– Sheljohn
Aug 8 '16 at 11:14
add a comment |
3 Answers
3
active
oldest
votes
@DavidCarlisle proposed a solution in comment of the OP. It seems to be sufficient to create a subdirectory _out/text
for the compilation to succeed.
add a comment |
I had the same issue and solved it by writing a build script that creates subdirectories in my build folder that mirror the subdirectories in my source folder before compiling:
#!/bin/sh
for OUTPUT in $(find src -type d)
do
mkdir dist/$OUTPUT
done
pdflatex -output-directory=./dist ./src/main.tex
This saves you having to manually create subdirectories every time you add one.
add a comment |
This is my solution, the same as Kyle Meenehan, but a little more elaborate using Makefile:
#!/usr/bin/make -f
# https://stackoverflow.com/questions/7123241/makefile-as-an-executable-script-with-shebang
ECHOCMD:=/bin/echo -e
SHELL := /bin/bash
# The main latex file
THESIS_MAIN_FILE := main
# This will be the pdf generated
THESIS_OUTPUT_NAME := thesis
# This is the directory where the temporary files are going to be
CACHE_DIRECTORY := cache
THESIS_MAIN_FILE_PATH := $(CACHE_DIRECTORY)/$(THESIS_MAIN_FILE).pdf
# Find all files ending with `main.tex`
LATEX_SOURCE_FILES := $(wildcard *main.tex)
# Create a new variable within all `LATEX_SOURCE_FILES` file names ending with `.pdf`
LATEX_PDF_FILES := $(LATEX_SOURCE_FILES:.tex=.pdf)
# https://stackoverflow.com/questions/55642491/how-to-check-whether-a-file-exists-outside-a-makefile-rule
FIND_EXEC := $(if $(wildcard /bin/find),,/usr)/bin/find
.PHONY: all help latex thesis verbose clean biber_hook biber_hook1 pdflatex_hook
pdflatex_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4
# http://stackoverflow.com/questions/1789594/how-do-i-write-the-cd-command-in-a-makefile
.ONESHELL:
# Default target
# https://stackoverflow.com/questions/46135614/how-to-call-makefile-recipe-rule-multiple-times
all: pdflatex_hook1 biber_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4 biber
# https://tex.stackexchange.com/questions/91592/where-to-find-official-and-extended-documentation-for-tex-latexs-commandlin
# https://tex.stackexchange.com/questions/52988/avoid-linebreaks-in-latex-console-log-output-or-increase-columns-in-terminal
PDF_LATEX_COMMAND = pdflatex --synctex=1 -halt-on-error -file-line-error
PDF_LATEX_COMMAND += $(if $(shell pdflatex --help | grep time-statistics),--time-statistics,)
PDF_LATEX_COMMAND += $(if $(shell pdflatex --help | grep max-print-line),--max-print-line=10000,)
LATEX = $(PDF_LATEX_COMMAND) --interaction=batchmode
LATEX += $(if $(shell pdflatex --help | grep aux-directory),-aux-directory="$(CACHE_DIRECTORY)",)
LATEX += $(if $(shell pdflatex --help | grep output-directory),-output-directory="$(CACHE_DIRECTORY)",)
# Copies the PDF to the current directory
# https://stackoverflow.com/questions/55671541/how-define-a-makefile-condition-and-reuse-it-in-several-build-rules/
define copy_resulting_pdf=
if [[ -f "${THESIS_MAIN_FILE_PATH}" ]];
then
printf 'Coping PDF...n';
cp "${THESIS_MAIN_FILE_PATH}" "${current_dir}/${THESIS_OUTPUT_NAME}.pdf";
else
printf "\nError: The PDF "${THESIS_MAIN_FILE_PATH}" was not generated!\n";
exit 1;
fi
endef
# https://stackoverflow.com/questions/4210042/exclude-directory-from-find-command
DIRECTORIES_TO_CREATE := $(shell "${FIND_EXEC}" -not -path "./**.git**"
-not -path "./pictures**" -type d
-not -path "./${CACHE_DIRECTORY}**" -type d)
# https://stackoverflow.com/questions/11469989/how-can-i-strip-first-x-characters-from-string-using-sed
define setup_envinronment =
$(eval current_dir := $(shell pwd)) echo $(current_dir) > /dev/null
printf "\n";
readarray -td' ' DIRECTORIES_TO_CREATE_ARRAY <<<"$(DIRECTORIES_TO_CREATE) ";
unset 'DIRECTORIES_TO_CREATE_ARRAY[-1]';
declare -p DIRECTORIES_TO_CREATE_ARRAY;
for directory_name in "$${DIRECTORIES_TO_CREATE_ARRAY[@]}";
do
full_cache_directory="${CACHE_DIRECTORY}/$${directory_name:2}";
printf "Creating %s\n" "$${full_cache_directory}";
mkdir -p "$${full_cache_directory}";
done
printf "\n";
endef
# Run pdflatex, biber, pdflatex
biber: setup_things biber_hook pdflatex_hook
$(copy_resulting_pdf)
setup_things:
$(setup_envinronment)
# Call biber to process the bibliography and does not attempt to show the elapsed time
# https://www.mankier.com/1/biber --debug
biber_hook biber_hook1:
$(setup_envinronment)
echo "Running biber quietly..."
biber --quiet --input-directory="$(CACHE_DIRECTORY)" --output-directory="$(CACHE_DIRECTORY)" $(THESIS_MAIN_FILE).bcf
# https://stackoverflow.com/questions/46135614/how-to-call-makefile-recipe-rule-multiple-times
pdflatex_hook pdflatex_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4: setup_things
@$(LATEX) $(LATEX_SOURCE_FILES)
# This rule will be called for every latex file and pdf associated
latex: $(LATEX_PDF_FILES)
$(setup_envinronment)
# Dynamically generated recipes for all PDF and latex files
%.pdf: %.tex
$(setup_envinronment)
@$(LATEX) $<
clean:
$(RM) -rv $(CACHE_DIRECTORY)
$(RM) -v $(THESIS_OUTPUT_NAME).pdf
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f323820%2fi-cant-write-on-file-foo-aux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
@DavidCarlisle proposed a solution in comment of the OP. It seems to be sufficient to create a subdirectory _out/text
for the compilation to succeed.
add a comment |
@DavidCarlisle proposed a solution in comment of the OP. It seems to be sufficient to create a subdirectory _out/text
for the compilation to succeed.
add a comment |
@DavidCarlisle proposed a solution in comment of the OP. It seems to be sufficient to create a subdirectory _out/text
for the compilation to succeed.
@DavidCarlisle proposed a solution in comment of the OP. It seems to be sufficient to create a subdirectory _out/text
for the compilation to succeed.
answered Aug 8 '16 at 11:13
SheljohnSheljohn
448418
448418
add a comment |
add a comment |
I had the same issue and solved it by writing a build script that creates subdirectories in my build folder that mirror the subdirectories in my source folder before compiling:
#!/bin/sh
for OUTPUT in $(find src -type d)
do
mkdir dist/$OUTPUT
done
pdflatex -output-directory=./dist ./src/main.tex
This saves you having to manually create subdirectories every time you add one.
add a comment |
I had the same issue and solved it by writing a build script that creates subdirectories in my build folder that mirror the subdirectories in my source folder before compiling:
#!/bin/sh
for OUTPUT in $(find src -type d)
do
mkdir dist/$OUTPUT
done
pdflatex -output-directory=./dist ./src/main.tex
This saves you having to manually create subdirectories every time you add one.
add a comment |
I had the same issue and solved it by writing a build script that creates subdirectories in my build folder that mirror the subdirectories in my source folder before compiling:
#!/bin/sh
for OUTPUT in $(find src -type d)
do
mkdir dist/$OUTPUT
done
pdflatex -output-directory=./dist ./src/main.tex
This saves you having to manually create subdirectories every time you add one.
I had the same issue and solved it by writing a build script that creates subdirectories in my build folder that mirror the subdirectories in my source folder before compiling:
#!/bin/sh
for OUTPUT in $(find src -type d)
do
mkdir dist/$OUTPUT
done
pdflatex -output-directory=./dist ./src/main.tex
This saves you having to manually create subdirectories every time you add one.
answered Mar 3 at 4:48
Kyle MeenehanKyle Meenehan
212
212
add a comment |
add a comment |
This is my solution, the same as Kyle Meenehan, but a little more elaborate using Makefile:
#!/usr/bin/make -f
# https://stackoverflow.com/questions/7123241/makefile-as-an-executable-script-with-shebang
ECHOCMD:=/bin/echo -e
SHELL := /bin/bash
# The main latex file
THESIS_MAIN_FILE := main
# This will be the pdf generated
THESIS_OUTPUT_NAME := thesis
# This is the directory where the temporary files are going to be
CACHE_DIRECTORY := cache
THESIS_MAIN_FILE_PATH := $(CACHE_DIRECTORY)/$(THESIS_MAIN_FILE).pdf
# Find all files ending with `main.tex`
LATEX_SOURCE_FILES := $(wildcard *main.tex)
# Create a new variable within all `LATEX_SOURCE_FILES` file names ending with `.pdf`
LATEX_PDF_FILES := $(LATEX_SOURCE_FILES:.tex=.pdf)
# https://stackoverflow.com/questions/55642491/how-to-check-whether-a-file-exists-outside-a-makefile-rule
FIND_EXEC := $(if $(wildcard /bin/find),,/usr)/bin/find
.PHONY: all help latex thesis verbose clean biber_hook biber_hook1 pdflatex_hook
pdflatex_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4
# http://stackoverflow.com/questions/1789594/how-do-i-write-the-cd-command-in-a-makefile
.ONESHELL:
# Default target
# https://stackoverflow.com/questions/46135614/how-to-call-makefile-recipe-rule-multiple-times
all: pdflatex_hook1 biber_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4 biber
# https://tex.stackexchange.com/questions/91592/where-to-find-official-and-extended-documentation-for-tex-latexs-commandlin
# https://tex.stackexchange.com/questions/52988/avoid-linebreaks-in-latex-console-log-output-or-increase-columns-in-terminal
PDF_LATEX_COMMAND = pdflatex --synctex=1 -halt-on-error -file-line-error
PDF_LATEX_COMMAND += $(if $(shell pdflatex --help | grep time-statistics),--time-statistics,)
PDF_LATEX_COMMAND += $(if $(shell pdflatex --help | grep max-print-line),--max-print-line=10000,)
LATEX = $(PDF_LATEX_COMMAND) --interaction=batchmode
LATEX += $(if $(shell pdflatex --help | grep aux-directory),-aux-directory="$(CACHE_DIRECTORY)",)
LATEX += $(if $(shell pdflatex --help | grep output-directory),-output-directory="$(CACHE_DIRECTORY)",)
# Copies the PDF to the current directory
# https://stackoverflow.com/questions/55671541/how-define-a-makefile-condition-and-reuse-it-in-several-build-rules/
define copy_resulting_pdf=
if [[ -f "${THESIS_MAIN_FILE_PATH}" ]];
then
printf 'Coping PDF...n';
cp "${THESIS_MAIN_FILE_PATH}" "${current_dir}/${THESIS_OUTPUT_NAME}.pdf";
else
printf "\nError: The PDF "${THESIS_MAIN_FILE_PATH}" was not generated!\n";
exit 1;
fi
endef
# https://stackoverflow.com/questions/4210042/exclude-directory-from-find-command
DIRECTORIES_TO_CREATE := $(shell "${FIND_EXEC}" -not -path "./**.git**"
-not -path "./pictures**" -type d
-not -path "./${CACHE_DIRECTORY}**" -type d)
# https://stackoverflow.com/questions/11469989/how-can-i-strip-first-x-characters-from-string-using-sed
define setup_envinronment =
$(eval current_dir := $(shell pwd)) echo $(current_dir) > /dev/null
printf "\n";
readarray -td' ' DIRECTORIES_TO_CREATE_ARRAY <<<"$(DIRECTORIES_TO_CREATE) ";
unset 'DIRECTORIES_TO_CREATE_ARRAY[-1]';
declare -p DIRECTORIES_TO_CREATE_ARRAY;
for directory_name in "$${DIRECTORIES_TO_CREATE_ARRAY[@]}";
do
full_cache_directory="${CACHE_DIRECTORY}/$${directory_name:2}";
printf "Creating %s\n" "$${full_cache_directory}";
mkdir -p "$${full_cache_directory}";
done
printf "\n";
endef
# Run pdflatex, biber, pdflatex
biber: setup_things biber_hook pdflatex_hook
$(copy_resulting_pdf)
setup_things:
$(setup_envinronment)
# Call biber to process the bibliography and does not attempt to show the elapsed time
# https://www.mankier.com/1/biber --debug
biber_hook biber_hook1:
$(setup_envinronment)
echo "Running biber quietly..."
biber --quiet --input-directory="$(CACHE_DIRECTORY)" --output-directory="$(CACHE_DIRECTORY)" $(THESIS_MAIN_FILE).bcf
# https://stackoverflow.com/questions/46135614/how-to-call-makefile-recipe-rule-multiple-times
pdflatex_hook pdflatex_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4: setup_things
@$(LATEX) $(LATEX_SOURCE_FILES)
# This rule will be called for every latex file and pdf associated
latex: $(LATEX_PDF_FILES)
$(setup_envinronment)
# Dynamically generated recipes for all PDF and latex files
%.pdf: %.tex
$(setup_envinronment)
@$(LATEX) $<
clean:
$(RM) -rv $(CACHE_DIRECTORY)
$(RM) -v $(THESIS_OUTPUT_NAME).pdf
add a comment |
This is my solution, the same as Kyle Meenehan, but a little more elaborate using Makefile:
#!/usr/bin/make -f
# https://stackoverflow.com/questions/7123241/makefile-as-an-executable-script-with-shebang
ECHOCMD:=/bin/echo -e
SHELL := /bin/bash
# The main latex file
THESIS_MAIN_FILE := main
# This will be the pdf generated
THESIS_OUTPUT_NAME := thesis
# This is the directory where the temporary files are going to be
CACHE_DIRECTORY := cache
THESIS_MAIN_FILE_PATH := $(CACHE_DIRECTORY)/$(THESIS_MAIN_FILE).pdf
# Find all files ending with `main.tex`
LATEX_SOURCE_FILES := $(wildcard *main.tex)
# Create a new variable within all `LATEX_SOURCE_FILES` file names ending with `.pdf`
LATEX_PDF_FILES := $(LATEX_SOURCE_FILES:.tex=.pdf)
# https://stackoverflow.com/questions/55642491/how-to-check-whether-a-file-exists-outside-a-makefile-rule
FIND_EXEC := $(if $(wildcard /bin/find),,/usr)/bin/find
.PHONY: all help latex thesis verbose clean biber_hook biber_hook1 pdflatex_hook
pdflatex_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4
# http://stackoverflow.com/questions/1789594/how-do-i-write-the-cd-command-in-a-makefile
.ONESHELL:
# Default target
# https://stackoverflow.com/questions/46135614/how-to-call-makefile-recipe-rule-multiple-times
all: pdflatex_hook1 biber_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4 biber
# https://tex.stackexchange.com/questions/91592/where-to-find-official-and-extended-documentation-for-tex-latexs-commandlin
# https://tex.stackexchange.com/questions/52988/avoid-linebreaks-in-latex-console-log-output-or-increase-columns-in-terminal
PDF_LATEX_COMMAND = pdflatex --synctex=1 -halt-on-error -file-line-error
PDF_LATEX_COMMAND += $(if $(shell pdflatex --help | grep time-statistics),--time-statistics,)
PDF_LATEX_COMMAND += $(if $(shell pdflatex --help | grep max-print-line),--max-print-line=10000,)
LATEX = $(PDF_LATEX_COMMAND) --interaction=batchmode
LATEX += $(if $(shell pdflatex --help | grep aux-directory),-aux-directory="$(CACHE_DIRECTORY)",)
LATEX += $(if $(shell pdflatex --help | grep output-directory),-output-directory="$(CACHE_DIRECTORY)",)
# Copies the PDF to the current directory
# https://stackoverflow.com/questions/55671541/how-define-a-makefile-condition-and-reuse-it-in-several-build-rules/
define copy_resulting_pdf=
if [[ -f "${THESIS_MAIN_FILE_PATH}" ]];
then
printf 'Coping PDF...n';
cp "${THESIS_MAIN_FILE_PATH}" "${current_dir}/${THESIS_OUTPUT_NAME}.pdf";
else
printf "\nError: The PDF "${THESIS_MAIN_FILE_PATH}" was not generated!\n";
exit 1;
fi
endef
# https://stackoverflow.com/questions/4210042/exclude-directory-from-find-command
DIRECTORIES_TO_CREATE := $(shell "${FIND_EXEC}" -not -path "./**.git**"
-not -path "./pictures**" -type d
-not -path "./${CACHE_DIRECTORY}**" -type d)
# https://stackoverflow.com/questions/11469989/how-can-i-strip-first-x-characters-from-string-using-sed
define setup_envinronment =
$(eval current_dir := $(shell pwd)) echo $(current_dir) > /dev/null
printf "\n";
readarray -td' ' DIRECTORIES_TO_CREATE_ARRAY <<<"$(DIRECTORIES_TO_CREATE) ";
unset 'DIRECTORIES_TO_CREATE_ARRAY[-1]';
declare -p DIRECTORIES_TO_CREATE_ARRAY;
for directory_name in "$${DIRECTORIES_TO_CREATE_ARRAY[@]}";
do
full_cache_directory="${CACHE_DIRECTORY}/$${directory_name:2}";
printf "Creating %s\n" "$${full_cache_directory}";
mkdir -p "$${full_cache_directory}";
done
printf "\n";
endef
# Run pdflatex, biber, pdflatex
biber: setup_things biber_hook pdflatex_hook
$(copy_resulting_pdf)
setup_things:
$(setup_envinronment)
# Call biber to process the bibliography and does not attempt to show the elapsed time
# https://www.mankier.com/1/biber --debug
biber_hook biber_hook1:
$(setup_envinronment)
echo "Running biber quietly..."
biber --quiet --input-directory="$(CACHE_DIRECTORY)" --output-directory="$(CACHE_DIRECTORY)" $(THESIS_MAIN_FILE).bcf
# https://stackoverflow.com/questions/46135614/how-to-call-makefile-recipe-rule-multiple-times
pdflatex_hook pdflatex_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4: setup_things
@$(LATEX) $(LATEX_SOURCE_FILES)
# This rule will be called for every latex file and pdf associated
latex: $(LATEX_PDF_FILES)
$(setup_envinronment)
# Dynamically generated recipes for all PDF and latex files
%.pdf: %.tex
$(setup_envinronment)
@$(LATEX) $<
clean:
$(RM) -rv $(CACHE_DIRECTORY)
$(RM) -v $(THESIS_OUTPUT_NAME).pdf
add a comment |
This is my solution, the same as Kyle Meenehan, but a little more elaborate using Makefile:
#!/usr/bin/make -f
# https://stackoverflow.com/questions/7123241/makefile-as-an-executable-script-with-shebang
ECHOCMD:=/bin/echo -e
SHELL := /bin/bash
# The main latex file
THESIS_MAIN_FILE := main
# This will be the pdf generated
THESIS_OUTPUT_NAME := thesis
# This is the directory where the temporary files are going to be
CACHE_DIRECTORY := cache
THESIS_MAIN_FILE_PATH := $(CACHE_DIRECTORY)/$(THESIS_MAIN_FILE).pdf
# Find all files ending with `main.tex`
LATEX_SOURCE_FILES := $(wildcard *main.tex)
# Create a new variable within all `LATEX_SOURCE_FILES` file names ending with `.pdf`
LATEX_PDF_FILES := $(LATEX_SOURCE_FILES:.tex=.pdf)
# https://stackoverflow.com/questions/55642491/how-to-check-whether-a-file-exists-outside-a-makefile-rule
FIND_EXEC := $(if $(wildcard /bin/find),,/usr)/bin/find
.PHONY: all help latex thesis verbose clean biber_hook biber_hook1 pdflatex_hook
pdflatex_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4
# http://stackoverflow.com/questions/1789594/how-do-i-write-the-cd-command-in-a-makefile
.ONESHELL:
# Default target
# https://stackoverflow.com/questions/46135614/how-to-call-makefile-recipe-rule-multiple-times
all: pdflatex_hook1 biber_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4 biber
# https://tex.stackexchange.com/questions/91592/where-to-find-official-and-extended-documentation-for-tex-latexs-commandlin
# https://tex.stackexchange.com/questions/52988/avoid-linebreaks-in-latex-console-log-output-or-increase-columns-in-terminal
PDF_LATEX_COMMAND = pdflatex --synctex=1 -halt-on-error -file-line-error
PDF_LATEX_COMMAND += $(if $(shell pdflatex --help | grep time-statistics),--time-statistics,)
PDF_LATEX_COMMAND += $(if $(shell pdflatex --help | grep max-print-line),--max-print-line=10000,)
LATEX = $(PDF_LATEX_COMMAND) --interaction=batchmode
LATEX += $(if $(shell pdflatex --help | grep aux-directory),-aux-directory="$(CACHE_DIRECTORY)",)
LATEX += $(if $(shell pdflatex --help | grep output-directory),-output-directory="$(CACHE_DIRECTORY)",)
# Copies the PDF to the current directory
# https://stackoverflow.com/questions/55671541/how-define-a-makefile-condition-and-reuse-it-in-several-build-rules/
define copy_resulting_pdf=
if [[ -f "${THESIS_MAIN_FILE_PATH}" ]];
then
printf 'Coping PDF...n';
cp "${THESIS_MAIN_FILE_PATH}" "${current_dir}/${THESIS_OUTPUT_NAME}.pdf";
else
printf "\nError: The PDF "${THESIS_MAIN_FILE_PATH}" was not generated!\n";
exit 1;
fi
endef
# https://stackoverflow.com/questions/4210042/exclude-directory-from-find-command
DIRECTORIES_TO_CREATE := $(shell "${FIND_EXEC}" -not -path "./**.git**"
-not -path "./pictures**" -type d
-not -path "./${CACHE_DIRECTORY}**" -type d)
# https://stackoverflow.com/questions/11469989/how-can-i-strip-first-x-characters-from-string-using-sed
define setup_envinronment =
$(eval current_dir := $(shell pwd)) echo $(current_dir) > /dev/null
printf "\n";
readarray -td' ' DIRECTORIES_TO_CREATE_ARRAY <<<"$(DIRECTORIES_TO_CREATE) ";
unset 'DIRECTORIES_TO_CREATE_ARRAY[-1]';
declare -p DIRECTORIES_TO_CREATE_ARRAY;
for directory_name in "$${DIRECTORIES_TO_CREATE_ARRAY[@]}";
do
full_cache_directory="${CACHE_DIRECTORY}/$${directory_name:2}";
printf "Creating %s\n" "$${full_cache_directory}";
mkdir -p "$${full_cache_directory}";
done
printf "\n";
endef
# Run pdflatex, biber, pdflatex
biber: setup_things biber_hook pdflatex_hook
$(copy_resulting_pdf)
setup_things:
$(setup_envinronment)
# Call biber to process the bibliography and does not attempt to show the elapsed time
# https://www.mankier.com/1/biber --debug
biber_hook biber_hook1:
$(setup_envinronment)
echo "Running biber quietly..."
biber --quiet --input-directory="$(CACHE_DIRECTORY)" --output-directory="$(CACHE_DIRECTORY)" $(THESIS_MAIN_FILE).bcf
# https://stackoverflow.com/questions/46135614/how-to-call-makefile-recipe-rule-multiple-times
pdflatex_hook pdflatex_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4: setup_things
@$(LATEX) $(LATEX_SOURCE_FILES)
# This rule will be called for every latex file and pdf associated
latex: $(LATEX_PDF_FILES)
$(setup_envinronment)
# Dynamically generated recipes for all PDF and latex files
%.pdf: %.tex
$(setup_envinronment)
@$(LATEX) $<
clean:
$(RM) -rv $(CACHE_DIRECTORY)
$(RM) -v $(THESIS_OUTPUT_NAME).pdf
This is my solution, the same as Kyle Meenehan, but a little more elaborate using Makefile:
#!/usr/bin/make -f
# https://stackoverflow.com/questions/7123241/makefile-as-an-executable-script-with-shebang
ECHOCMD:=/bin/echo -e
SHELL := /bin/bash
# The main latex file
THESIS_MAIN_FILE := main
# This will be the pdf generated
THESIS_OUTPUT_NAME := thesis
# This is the directory where the temporary files are going to be
CACHE_DIRECTORY := cache
THESIS_MAIN_FILE_PATH := $(CACHE_DIRECTORY)/$(THESIS_MAIN_FILE).pdf
# Find all files ending with `main.tex`
LATEX_SOURCE_FILES := $(wildcard *main.tex)
# Create a new variable within all `LATEX_SOURCE_FILES` file names ending with `.pdf`
LATEX_PDF_FILES := $(LATEX_SOURCE_FILES:.tex=.pdf)
# https://stackoverflow.com/questions/55642491/how-to-check-whether-a-file-exists-outside-a-makefile-rule
FIND_EXEC := $(if $(wildcard /bin/find),,/usr)/bin/find
.PHONY: all help latex thesis verbose clean biber_hook biber_hook1 pdflatex_hook
pdflatex_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4
# http://stackoverflow.com/questions/1789594/how-do-i-write-the-cd-command-in-a-makefile
.ONESHELL:
# Default target
# https://stackoverflow.com/questions/46135614/how-to-call-makefile-recipe-rule-multiple-times
all: pdflatex_hook1 biber_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4 biber
# https://tex.stackexchange.com/questions/91592/where-to-find-official-and-extended-documentation-for-tex-latexs-commandlin
# https://tex.stackexchange.com/questions/52988/avoid-linebreaks-in-latex-console-log-output-or-increase-columns-in-terminal
PDF_LATEX_COMMAND = pdflatex --synctex=1 -halt-on-error -file-line-error
PDF_LATEX_COMMAND += $(if $(shell pdflatex --help | grep time-statistics),--time-statistics,)
PDF_LATEX_COMMAND += $(if $(shell pdflatex --help | grep max-print-line),--max-print-line=10000,)
LATEX = $(PDF_LATEX_COMMAND) --interaction=batchmode
LATEX += $(if $(shell pdflatex --help | grep aux-directory),-aux-directory="$(CACHE_DIRECTORY)",)
LATEX += $(if $(shell pdflatex --help | grep output-directory),-output-directory="$(CACHE_DIRECTORY)",)
# Copies the PDF to the current directory
# https://stackoverflow.com/questions/55671541/how-define-a-makefile-condition-and-reuse-it-in-several-build-rules/
define copy_resulting_pdf=
if [[ -f "${THESIS_MAIN_FILE_PATH}" ]];
then
printf 'Coping PDF...n';
cp "${THESIS_MAIN_FILE_PATH}" "${current_dir}/${THESIS_OUTPUT_NAME}.pdf";
else
printf "\nError: The PDF "${THESIS_MAIN_FILE_PATH}" was not generated!\n";
exit 1;
fi
endef
# https://stackoverflow.com/questions/4210042/exclude-directory-from-find-command
DIRECTORIES_TO_CREATE := $(shell "${FIND_EXEC}" -not -path "./**.git**"
-not -path "./pictures**" -type d
-not -path "./${CACHE_DIRECTORY}**" -type d)
# https://stackoverflow.com/questions/11469989/how-can-i-strip-first-x-characters-from-string-using-sed
define setup_envinronment =
$(eval current_dir := $(shell pwd)) echo $(current_dir) > /dev/null
printf "\n";
readarray -td' ' DIRECTORIES_TO_CREATE_ARRAY <<<"$(DIRECTORIES_TO_CREATE) ";
unset 'DIRECTORIES_TO_CREATE_ARRAY[-1]';
declare -p DIRECTORIES_TO_CREATE_ARRAY;
for directory_name in "$${DIRECTORIES_TO_CREATE_ARRAY[@]}";
do
full_cache_directory="${CACHE_DIRECTORY}/$${directory_name:2}";
printf "Creating %s\n" "$${full_cache_directory}";
mkdir -p "$${full_cache_directory}";
done
printf "\n";
endef
# Run pdflatex, biber, pdflatex
biber: setup_things biber_hook pdflatex_hook
$(copy_resulting_pdf)
setup_things:
$(setup_envinronment)
# Call biber to process the bibliography and does not attempt to show the elapsed time
# https://www.mankier.com/1/biber --debug
biber_hook biber_hook1:
$(setup_envinronment)
echo "Running biber quietly..."
biber --quiet --input-directory="$(CACHE_DIRECTORY)" --output-directory="$(CACHE_DIRECTORY)" $(THESIS_MAIN_FILE).bcf
# https://stackoverflow.com/questions/46135614/how-to-call-makefile-recipe-rule-multiple-times
pdflatex_hook pdflatex_hook1 pdflatex_hook2 pdflatex_hook3 pdflatex_hook4: setup_things
@$(LATEX) $(LATEX_SOURCE_FILES)
# This rule will be called for every latex file and pdf associated
latex: $(LATEX_PDF_FILES)
$(setup_envinronment)
# Dynamically generated recipes for all PDF and latex files
%.pdf: %.tex
$(setup_envinronment)
@$(LATEX) $<
clean:
$(RM) -rv $(CACHE_DIRECTORY)
$(RM) -v $(THESIS_OUTPUT_NAME).pdf
answered 14 mins ago
useruser
1,28621030
1,28621030
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f323820%2fi-cant-write-on-file-foo-aux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
I think you'd need (at least) a text subdirectory of
_out
but it's always simpler not to use--output-directory
which greatly complicates the processing model and provides no features.– David Carlisle
Aug 8 '16 at 10:59
You are right, it was just a matter of creating a subfolder
_out/text
, sorry for that silly question!– Sheljohn
Aug 8 '16 at 11:14