Tikz externalization and global arguments: no update
up vote
3
down vote
favorite
Consider the following TikzExample.tex
example to be compiled via pdflatex -shell-escape TikzExample
:
documentclass{article}
usepackage{graphicx}
usepackage{tikz}
usetikzlibrary{external}
tikzexternalize
definecolor{Diag}{cmyk}{0.84,0,0.05,0.40}
begin{document}
begin{figure}[ht]
centering
tikzsetnextfilename{figure1}
input{figure1tikz.tex}
end{figure}
begin{figure}[ht]
centering
tikzsetnextfilename{figure2}
input{figure2tikz.tex}
end{figure}
end{document}
where figure1tikz.tex
is:
begin{tikzpicture}
draw[fill=Diag!50] (0,0) rectangle (1,1);
draw (0,0) -- (1,1);
end{tikzpicture}
and figure2tikz.tex
is:
begin{tikzpicture}
draw[fill=red!50] (0,0) rectangle (1,1);
draw[Diag,line width=2pt] (0,0) -- (1,1);
end{tikzpicture}
If the above tikz pictures are changed, then compiling the main document will update the plots. Good! However, changing the global color Diag
has no effect on new compilations. This makes sense given how externalization works, that is if a tikz file is newer than the main document, then the tikz file is recompiled. How could we ask the system to recompile all plots affected by a global argument like the Diag
color above? One solution would be to delete all corresponding pdf, I think, but this is not ideal.
tikz-pgf externalize
|
show 1 more comment
up vote
3
down vote
favorite
Consider the following TikzExample.tex
example to be compiled via pdflatex -shell-escape TikzExample
:
documentclass{article}
usepackage{graphicx}
usepackage{tikz}
usetikzlibrary{external}
tikzexternalize
definecolor{Diag}{cmyk}{0.84,0,0.05,0.40}
begin{document}
begin{figure}[ht]
centering
tikzsetnextfilename{figure1}
input{figure1tikz.tex}
end{figure}
begin{figure}[ht]
centering
tikzsetnextfilename{figure2}
input{figure2tikz.tex}
end{figure}
end{document}
where figure1tikz.tex
is:
begin{tikzpicture}
draw[fill=Diag!50] (0,0) rectangle (1,1);
draw (0,0) -- (1,1);
end{tikzpicture}
and figure2tikz.tex
is:
begin{tikzpicture}
draw[fill=red!50] (0,0) rectangle (1,1);
draw[Diag,line width=2pt] (0,0) -- (1,1);
end{tikzpicture}
If the above tikz pictures are changed, then compiling the main document will update the plots. Good! However, changing the global color Diag
has no effect on new compilations. This makes sense given how externalization works, that is if a tikz file is newer than the main document, then the tikz file is recompiled. How could we ask the system to recompile all plots affected by a global argument like the Diag
color above? One solution would be to delete all corresponding pdf, I think, but this is not ideal.
tikz-pgf externalize
you can always force a remake with theforce remake
key.
– Ulrike Fischer
Nov 15 at 21:50
@UlrikeFischer good point but it goes slightly against the automatic externalization.
– pluton
Nov 15 at 22:05
Sorry but there is no (sensible) way that tikz can look into the pictures and check if they use a specific color. If you change such a global variable you will have to recreate all figures.
– Ulrike Fischer
Nov 15 at 22:07
@UlrikeFischer Or maybe what could be done is to store all these global variables in a dedicated file and ask tikz to look after possible changes in that file when compiling the main document in a way similar to what it does for actual external tikz pictures??
– pluton
Nov 15 at 22:18
Sorry but you know when you change the global variables, so why do you need some complicated system to check this?
– Ulrike Fischer
Nov 15 at 22:25
|
show 1 more comment
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Consider the following TikzExample.tex
example to be compiled via pdflatex -shell-escape TikzExample
:
documentclass{article}
usepackage{graphicx}
usepackage{tikz}
usetikzlibrary{external}
tikzexternalize
definecolor{Diag}{cmyk}{0.84,0,0.05,0.40}
begin{document}
begin{figure}[ht]
centering
tikzsetnextfilename{figure1}
input{figure1tikz.tex}
end{figure}
begin{figure}[ht]
centering
tikzsetnextfilename{figure2}
input{figure2tikz.tex}
end{figure}
end{document}
where figure1tikz.tex
is:
begin{tikzpicture}
draw[fill=Diag!50] (0,0) rectangle (1,1);
draw (0,0) -- (1,1);
end{tikzpicture}
and figure2tikz.tex
is:
begin{tikzpicture}
draw[fill=red!50] (0,0) rectangle (1,1);
draw[Diag,line width=2pt] (0,0) -- (1,1);
end{tikzpicture}
If the above tikz pictures are changed, then compiling the main document will update the plots. Good! However, changing the global color Diag
has no effect on new compilations. This makes sense given how externalization works, that is if a tikz file is newer than the main document, then the tikz file is recompiled. How could we ask the system to recompile all plots affected by a global argument like the Diag
color above? One solution would be to delete all corresponding pdf, I think, but this is not ideal.
tikz-pgf externalize
Consider the following TikzExample.tex
example to be compiled via pdflatex -shell-escape TikzExample
:
documentclass{article}
usepackage{graphicx}
usepackage{tikz}
usetikzlibrary{external}
tikzexternalize
definecolor{Diag}{cmyk}{0.84,0,0.05,0.40}
begin{document}
begin{figure}[ht]
centering
tikzsetnextfilename{figure1}
input{figure1tikz.tex}
end{figure}
begin{figure}[ht]
centering
tikzsetnextfilename{figure2}
input{figure2tikz.tex}
end{figure}
end{document}
where figure1tikz.tex
is:
begin{tikzpicture}
draw[fill=Diag!50] (0,0) rectangle (1,1);
draw (0,0) -- (1,1);
end{tikzpicture}
and figure2tikz.tex
is:
begin{tikzpicture}
draw[fill=red!50] (0,0) rectangle (1,1);
draw[Diag,line width=2pt] (0,0) -- (1,1);
end{tikzpicture}
If the above tikz pictures are changed, then compiling the main document will update the plots. Good! However, changing the global color Diag
has no effect on new compilations. This makes sense given how externalization works, that is if a tikz file is newer than the main document, then the tikz file is recompiled. How could we ask the system to recompile all plots affected by a global argument like the Diag
color above? One solution would be to delete all corresponding pdf, I think, but this is not ideal.
tikz-pgf externalize
tikz-pgf externalize
edited Nov 15 at 21:10
asked Nov 15 at 21:01
pluton
7,885960129
7,885960129
you can always force a remake with theforce remake
key.
– Ulrike Fischer
Nov 15 at 21:50
@UlrikeFischer good point but it goes slightly against the automatic externalization.
– pluton
Nov 15 at 22:05
Sorry but there is no (sensible) way that tikz can look into the pictures and check if they use a specific color. If you change such a global variable you will have to recreate all figures.
– Ulrike Fischer
Nov 15 at 22:07
@UlrikeFischer Or maybe what could be done is to store all these global variables in a dedicated file and ask tikz to look after possible changes in that file when compiling the main document in a way similar to what it does for actual external tikz pictures??
– pluton
Nov 15 at 22:18
Sorry but you know when you change the global variables, so why do you need some complicated system to check this?
– Ulrike Fischer
Nov 15 at 22:25
|
show 1 more comment
you can always force a remake with theforce remake
key.
– Ulrike Fischer
Nov 15 at 21:50
@UlrikeFischer good point but it goes slightly against the automatic externalization.
– pluton
Nov 15 at 22:05
Sorry but there is no (sensible) way that tikz can look into the pictures and check if they use a specific color. If you change such a global variable you will have to recreate all figures.
– Ulrike Fischer
Nov 15 at 22:07
@UlrikeFischer Or maybe what could be done is to store all these global variables in a dedicated file and ask tikz to look after possible changes in that file when compiling the main document in a way similar to what it does for actual external tikz pictures??
– pluton
Nov 15 at 22:18
Sorry but you know when you change the global variables, so why do you need some complicated system to check this?
– Ulrike Fischer
Nov 15 at 22:25
you can always force a remake with the
force remake
key.– Ulrike Fischer
Nov 15 at 21:50
you can always force a remake with the
force remake
key.– Ulrike Fischer
Nov 15 at 21:50
@UlrikeFischer good point but it goes slightly against the automatic externalization.
– pluton
Nov 15 at 22:05
@UlrikeFischer good point but it goes slightly against the automatic externalization.
– pluton
Nov 15 at 22:05
Sorry but there is no (sensible) way that tikz can look into the pictures and check if they use a specific color. If you change such a global variable you will have to recreate all figures.
– Ulrike Fischer
Nov 15 at 22:07
Sorry but there is no (sensible) way that tikz can look into the pictures and check if they use a specific color. If you change such a global variable you will have to recreate all figures.
– Ulrike Fischer
Nov 15 at 22:07
@UlrikeFischer Or maybe what could be done is to store all these global variables in a dedicated file and ask tikz to look after possible changes in that file when compiling the main document in a way similar to what it does for actual external tikz pictures??
– pluton
Nov 15 at 22:18
@UlrikeFischer Or maybe what could be done is to store all these global variables in a dedicated file and ask tikz to look after possible changes in that file when compiling the main document in a way similar to what it does for actual external tikz pictures??
– pluton
Nov 15 at 22:18
Sorry but you know when you change the global variables, so why do you need some complicated system to check this?
– Ulrike Fischer
Nov 15 at 22:25
Sorry but you know when you change the global variables, so why do you need some complicated system to check this?
– Ulrike Fischer
Nov 15 at 22:25
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
2
down vote
You can make the generated filenames depend on a hash of the meaning
of any macros that you want to use as a dependency. For colour you can use the internal macro csnamestringcolor@<color-name>endcsname
Note if you change the color the generated files change, but it doesn't clean up and remove old ones so you will accumulate
figure1-31D7BEC4791629B82ADF280BFE7B3E1E.pdf
figure1-334FBFF45DDEC5AE00C91FC51A840D48.pdf
unless you periodically delete them.
documentclass{article}
usepackage{graphicx}
usepackage{tikz}
usetikzlibrary{external}
tikzexternalize
definecolor{Diag}{cmyk}{0.84,1,0.05,0.40}
edefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname}}
begin{document}
begin{figure}[ht]
centering
tikzsetnextfilename{figure1-Diagsum}
input{figure1tikz.tex}
end{figure}
begin{figure}[ht]
centering
tikzsetnextfilename{figure2-Diagsum}
input{figure2tikz.tex}
end{figure}
end{document}
What would happen if I need to define other global variables like linewidth? Essentially, I would like to globally parameterize all possible graphical aspects of pgfplots in a large document, so that all plots are consistent. It could be gird color, grid size, background color, axis color, axis with, and so on...
– pluton
Nov 16 at 11:47
@pluton you just addthelinewidth
: a definition likeedefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname thelinewidth}}
hashes on the color and linewidth, so you just have to make a hash that specifies all your dependencies as a one-off cost, then if any of them change the hash will change.
– David Carlisle
Nov 16 at 16:38
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
You can make the generated filenames depend on a hash of the meaning
of any macros that you want to use as a dependency. For colour you can use the internal macro csnamestringcolor@<color-name>endcsname
Note if you change the color the generated files change, but it doesn't clean up and remove old ones so you will accumulate
figure1-31D7BEC4791629B82ADF280BFE7B3E1E.pdf
figure1-334FBFF45DDEC5AE00C91FC51A840D48.pdf
unless you periodically delete them.
documentclass{article}
usepackage{graphicx}
usepackage{tikz}
usetikzlibrary{external}
tikzexternalize
definecolor{Diag}{cmyk}{0.84,1,0.05,0.40}
edefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname}}
begin{document}
begin{figure}[ht]
centering
tikzsetnextfilename{figure1-Diagsum}
input{figure1tikz.tex}
end{figure}
begin{figure}[ht]
centering
tikzsetnextfilename{figure2-Diagsum}
input{figure2tikz.tex}
end{figure}
end{document}
What would happen if I need to define other global variables like linewidth? Essentially, I would like to globally parameterize all possible graphical aspects of pgfplots in a large document, so that all plots are consistent. It could be gird color, grid size, background color, axis color, axis with, and so on...
– pluton
Nov 16 at 11:47
@pluton you just addthelinewidth
: a definition likeedefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname thelinewidth}}
hashes on the color and linewidth, so you just have to make a hash that specifies all your dependencies as a one-off cost, then if any of them change the hash will change.
– David Carlisle
Nov 16 at 16:38
add a comment |
up vote
2
down vote
You can make the generated filenames depend on a hash of the meaning
of any macros that you want to use as a dependency. For colour you can use the internal macro csnamestringcolor@<color-name>endcsname
Note if you change the color the generated files change, but it doesn't clean up and remove old ones so you will accumulate
figure1-31D7BEC4791629B82ADF280BFE7B3E1E.pdf
figure1-334FBFF45DDEC5AE00C91FC51A840D48.pdf
unless you periodically delete them.
documentclass{article}
usepackage{graphicx}
usepackage{tikz}
usetikzlibrary{external}
tikzexternalize
definecolor{Diag}{cmyk}{0.84,1,0.05,0.40}
edefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname}}
begin{document}
begin{figure}[ht]
centering
tikzsetnextfilename{figure1-Diagsum}
input{figure1tikz.tex}
end{figure}
begin{figure}[ht]
centering
tikzsetnextfilename{figure2-Diagsum}
input{figure2tikz.tex}
end{figure}
end{document}
What would happen if I need to define other global variables like linewidth? Essentially, I would like to globally parameterize all possible graphical aspects of pgfplots in a large document, so that all plots are consistent. It could be gird color, grid size, background color, axis color, axis with, and so on...
– pluton
Nov 16 at 11:47
@pluton you just addthelinewidth
: a definition likeedefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname thelinewidth}}
hashes on the color and linewidth, so you just have to make a hash that specifies all your dependencies as a one-off cost, then if any of them change the hash will change.
– David Carlisle
Nov 16 at 16:38
add a comment |
up vote
2
down vote
up vote
2
down vote
You can make the generated filenames depend on a hash of the meaning
of any macros that you want to use as a dependency. For colour you can use the internal macro csnamestringcolor@<color-name>endcsname
Note if you change the color the generated files change, but it doesn't clean up and remove old ones so you will accumulate
figure1-31D7BEC4791629B82ADF280BFE7B3E1E.pdf
figure1-334FBFF45DDEC5AE00C91FC51A840D48.pdf
unless you periodically delete them.
documentclass{article}
usepackage{graphicx}
usepackage{tikz}
usetikzlibrary{external}
tikzexternalize
definecolor{Diag}{cmyk}{0.84,1,0.05,0.40}
edefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname}}
begin{document}
begin{figure}[ht]
centering
tikzsetnextfilename{figure1-Diagsum}
input{figure1tikz.tex}
end{figure}
begin{figure}[ht]
centering
tikzsetnextfilename{figure2-Diagsum}
input{figure2tikz.tex}
end{figure}
end{document}
You can make the generated filenames depend on a hash of the meaning
of any macros that you want to use as a dependency. For colour you can use the internal macro csnamestringcolor@<color-name>endcsname
Note if you change the color the generated files change, but it doesn't clean up and remove old ones so you will accumulate
figure1-31D7BEC4791629B82ADF280BFE7B3E1E.pdf
figure1-334FBFF45DDEC5AE00C91FC51A840D48.pdf
unless you periodically delete them.
documentclass{article}
usepackage{graphicx}
usepackage{tikz}
usetikzlibrary{external}
tikzexternalize
definecolor{Diag}{cmyk}{0.84,1,0.05,0.40}
edefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname}}
begin{document}
begin{figure}[ht]
centering
tikzsetnextfilename{figure1-Diagsum}
input{figure1tikz.tex}
end{figure}
begin{figure}[ht]
centering
tikzsetnextfilename{figure2-Diagsum}
input{figure2tikz.tex}
end{figure}
end{document}
answered Nov 16 at 1:23
David Carlisle
477k3811061841
477k3811061841
What would happen if I need to define other global variables like linewidth? Essentially, I would like to globally parameterize all possible graphical aspects of pgfplots in a large document, so that all plots are consistent. It could be gird color, grid size, background color, axis color, axis with, and so on...
– pluton
Nov 16 at 11:47
@pluton you just addthelinewidth
: a definition likeedefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname thelinewidth}}
hashes on the color and linewidth, so you just have to make a hash that specifies all your dependencies as a one-off cost, then if any of them change the hash will change.
– David Carlisle
Nov 16 at 16:38
add a comment |
What would happen if I need to define other global variables like linewidth? Essentially, I would like to globally parameterize all possible graphical aspects of pgfplots in a large document, so that all plots are consistent. It could be gird color, grid size, background color, axis color, axis with, and so on...
– pluton
Nov 16 at 11:47
@pluton you just addthelinewidth
: a definition likeedefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname thelinewidth}}
hashes on the color and linewidth, so you just have to make a hash that specifies all your dependencies as a one-off cost, then if any of them change the hash will change.
– David Carlisle
Nov 16 at 16:38
What would happen if I need to define other global variables like linewidth? Essentially, I would like to globally parameterize all possible graphical aspects of pgfplots in a large document, so that all plots are consistent. It could be gird color, grid size, background color, axis color, axis with, and so on...
– pluton
Nov 16 at 11:47
What would happen if I need to define other global variables like linewidth? Essentially, I would like to globally parameterize all possible graphical aspects of pgfplots in a large document, so that all plots are consistent. It could be gird color, grid size, background color, axis color, axis with, and so on...
– pluton
Nov 16 at 11:47
@pluton you just add
thelinewidth
: a definition like edefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname thelinewidth}}
hashes on the color and linewidth, so you just have to make a hash that specifies all your dependencies as a one-off cost, then if any of them change the hash will change.– David Carlisle
Nov 16 at 16:38
@pluton you just add
thelinewidth
: a definition like edefDiagsum{pdfmdfivesum{expandaftermeaningcsnamestringcolor@Diagendcsname thelinewidth}}
hashes on the color and linewidth, so you just have to make a hash that specifies all your dependencies as a one-off cost, then if any of them change the hash will change.– David Carlisle
Nov 16 at 16:38
add a comment |
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%2f460200%2ftikz-externalization-and-global-arguments-no-update%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
you can always force a remake with the
force remake
key.– Ulrike Fischer
Nov 15 at 21:50
@UlrikeFischer good point but it goes slightly against the automatic externalization.
– pluton
Nov 15 at 22:05
Sorry but there is no (sensible) way that tikz can look into the pictures and check if they use a specific color. If you change such a global variable you will have to recreate all figures.
– Ulrike Fischer
Nov 15 at 22:07
@UlrikeFischer Or maybe what could be done is to store all these global variables in a dedicated file and ask tikz to look after possible changes in that file when compiling the main document in a way similar to what it does for actual external tikz pictures??
– pluton
Nov 15 at 22:18
Sorry but you know when you change the global variables, so why do you need some complicated system to check this?
– Ulrike Fischer
Nov 15 at 22:25