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.










share|improve this question
























  • 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















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.










share|improve this question
























  • 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













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.










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 at 21:10

























asked Nov 15 at 21:01









pluton

7,885960129




7,885960129












  • 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


















  • 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
















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










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.



enter image description here



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}





share|improve this answer





















  • 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













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',
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
});


}
});














 

draft saved


draft discarded


















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

























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.



enter image description here



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}





share|improve this answer





















  • 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

















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.



enter image description here



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}





share|improve this answer





















  • 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















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.



enter image description here



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}





share|improve this answer












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.



enter image description here



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}






share|improve this answer












share|improve this answer



share|improve this answer










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 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




















  • 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


















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




















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?