Using beamer tools in tikz, without creating slides












2















I want to create a tikz picture that makes usage of beamer commands such as only<2>, thereby creating multiple pages and adding lines etc. only in the second page.
I then later on want to include these pages in a presentation.



Currently, I'm doing that by using documentclass{beamer}, and putting the tikzpicture inside a frame. However, this forces me to finish the presentation in this document: I need to specify frame title, and also footer, and presentation styles.



I would much rather just create the plain pictures here, include them in the other presentation using begin{frame}{Foo} includegraphics{...}end{frame}. However, when I do that inside beamer, there is unnecessary white space around the tikzpictures. When I don't do it inside beamer, I cannot use the only. What should I do?



%documentclass[tikz]{standalone}
documentclass{beamer}
usepackage{tikz}
usepackage{pgfplots}
begin{document}

begin{frame}

begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
only<2>{addplot[blue, thick, dashed] {2*x};}
end{axis}
end{tikzpicture}
end{frame}

end{document}









share|improve this question


















  • 1





    There is the beamerarticle package (part of the beamer class) that allows you to use beamer commands in other classes (such as article), which might be useful here. See page 209 of the manual.

    – Marijn
    Feb 20 at 13:02











  • @Marijn Using usepackage[noxcolor]{beamerarticle} allows me to compile everything as tikz standalone, but will only show the "last page" of each slide, instead of having several pages. Unfortunately, I cannot find this use caseto be detailed in the manual.

    – FooBar
    Feb 20 at 13:54













  • How about standalone with standaloneframes, as e.g. in tex.stackexchange.com/a/168705/121799 ?

    – marmot
    Feb 20 at 14:58











  • @marmot Better, but pictures are not full scale in the page. Including the pdfs in other presentation will add unnecessary white space.

    – FooBar
    Feb 20 at 16:20













  • Doesn't tex.stackexchange.com/a/168705/121799 specifically tell you how to include pictures of that sort? (Or are you just looking for an ordinary ifnum? See e.g. tex.stackexchange.com/a/459641/121799 for how to use it for drawing certain things only on certain "frames". Sometimes ifcase can be useful.)

    – marmot
    Feb 20 at 16:24
















2















I want to create a tikz picture that makes usage of beamer commands such as only<2>, thereby creating multiple pages and adding lines etc. only in the second page.
I then later on want to include these pages in a presentation.



Currently, I'm doing that by using documentclass{beamer}, and putting the tikzpicture inside a frame. However, this forces me to finish the presentation in this document: I need to specify frame title, and also footer, and presentation styles.



I would much rather just create the plain pictures here, include them in the other presentation using begin{frame}{Foo} includegraphics{...}end{frame}. However, when I do that inside beamer, there is unnecessary white space around the tikzpictures. When I don't do it inside beamer, I cannot use the only. What should I do?



%documentclass[tikz]{standalone}
documentclass{beamer}
usepackage{tikz}
usepackage{pgfplots}
begin{document}

begin{frame}

begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
only<2>{addplot[blue, thick, dashed] {2*x};}
end{axis}
end{tikzpicture}
end{frame}

end{document}









share|improve this question


















  • 1





    There is the beamerarticle package (part of the beamer class) that allows you to use beamer commands in other classes (such as article), which might be useful here. See page 209 of the manual.

    – Marijn
    Feb 20 at 13:02











  • @Marijn Using usepackage[noxcolor]{beamerarticle} allows me to compile everything as tikz standalone, but will only show the "last page" of each slide, instead of having several pages. Unfortunately, I cannot find this use caseto be detailed in the manual.

    – FooBar
    Feb 20 at 13:54













  • How about standalone with standaloneframes, as e.g. in tex.stackexchange.com/a/168705/121799 ?

    – marmot
    Feb 20 at 14:58











  • @marmot Better, but pictures are not full scale in the page. Including the pdfs in other presentation will add unnecessary white space.

    – FooBar
    Feb 20 at 16:20













  • Doesn't tex.stackexchange.com/a/168705/121799 specifically tell you how to include pictures of that sort? (Or are you just looking for an ordinary ifnum? See e.g. tex.stackexchange.com/a/459641/121799 for how to use it for drawing certain things only on certain "frames". Sometimes ifcase can be useful.)

    – marmot
    Feb 20 at 16:24














2












2








2








I want to create a tikz picture that makes usage of beamer commands such as only<2>, thereby creating multiple pages and adding lines etc. only in the second page.
I then later on want to include these pages in a presentation.



Currently, I'm doing that by using documentclass{beamer}, and putting the tikzpicture inside a frame. However, this forces me to finish the presentation in this document: I need to specify frame title, and also footer, and presentation styles.



I would much rather just create the plain pictures here, include them in the other presentation using begin{frame}{Foo} includegraphics{...}end{frame}. However, when I do that inside beamer, there is unnecessary white space around the tikzpictures. When I don't do it inside beamer, I cannot use the only. What should I do?



%documentclass[tikz]{standalone}
documentclass{beamer}
usepackage{tikz}
usepackage{pgfplots}
begin{document}

begin{frame}

begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
only<2>{addplot[blue, thick, dashed] {2*x};}
end{axis}
end{tikzpicture}
end{frame}

end{document}









share|improve this question














I want to create a tikz picture that makes usage of beamer commands such as only<2>, thereby creating multiple pages and adding lines etc. only in the second page.
I then later on want to include these pages in a presentation.



Currently, I'm doing that by using documentclass{beamer}, and putting the tikzpicture inside a frame. However, this forces me to finish the presentation in this document: I need to specify frame title, and also footer, and presentation styles.



I would much rather just create the plain pictures here, include them in the other presentation using begin{frame}{Foo} includegraphics{...}end{frame}. However, when I do that inside beamer, there is unnecessary white space around the tikzpictures. When I don't do it inside beamer, I cannot use the only. What should I do?



%documentclass[tikz]{standalone}
documentclass{beamer}
usepackage{tikz}
usepackage{pgfplots}
begin{document}

begin{frame}

begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
only<2>{addplot[blue, thick, dashed] {2*x};}
end{axis}
end{tikzpicture}
end{frame}

end{document}






tikz-pgf beamer






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 20 at 12:32









FooBarFooBar

414213




414213








  • 1





    There is the beamerarticle package (part of the beamer class) that allows you to use beamer commands in other classes (such as article), which might be useful here. See page 209 of the manual.

    – Marijn
    Feb 20 at 13:02











  • @Marijn Using usepackage[noxcolor]{beamerarticle} allows me to compile everything as tikz standalone, but will only show the "last page" of each slide, instead of having several pages. Unfortunately, I cannot find this use caseto be detailed in the manual.

    – FooBar
    Feb 20 at 13:54













  • How about standalone with standaloneframes, as e.g. in tex.stackexchange.com/a/168705/121799 ?

    – marmot
    Feb 20 at 14:58











  • @marmot Better, but pictures are not full scale in the page. Including the pdfs in other presentation will add unnecessary white space.

    – FooBar
    Feb 20 at 16:20













  • Doesn't tex.stackexchange.com/a/168705/121799 specifically tell you how to include pictures of that sort? (Or are you just looking for an ordinary ifnum? See e.g. tex.stackexchange.com/a/459641/121799 for how to use it for drawing certain things only on certain "frames". Sometimes ifcase can be useful.)

    – marmot
    Feb 20 at 16:24














  • 1





    There is the beamerarticle package (part of the beamer class) that allows you to use beamer commands in other classes (such as article), which might be useful here. See page 209 of the manual.

    – Marijn
    Feb 20 at 13:02











  • @Marijn Using usepackage[noxcolor]{beamerarticle} allows me to compile everything as tikz standalone, but will only show the "last page" of each slide, instead of having several pages. Unfortunately, I cannot find this use caseto be detailed in the manual.

    – FooBar
    Feb 20 at 13:54













  • How about standalone with standaloneframes, as e.g. in tex.stackexchange.com/a/168705/121799 ?

    – marmot
    Feb 20 at 14:58











  • @marmot Better, but pictures are not full scale in the page. Including the pdfs in other presentation will add unnecessary white space.

    – FooBar
    Feb 20 at 16:20













  • Doesn't tex.stackexchange.com/a/168705/121799 specifically tell you how to include pictures of that sort? (Or are you just looking for an ordinary ifnum? See e.g. tex.stackexchange.com/a/459641/121799 for how to use it for drawing certain things only on certain "frames". Sometimes ifcase can be useful.)

    – marmot
    Feb 20 at 16:24








1




1





There is the beamerarticle package (part of the beamer class) that allows you to use beamer commands in other classes (such as article), which might be useful here. See page 209 of the manual.

– Marijn
Feb 20 at 13:02





There is the beamerarticle package (part of the beamer class) that allows you to use beamer commands in other classes (such as article), which might be useful here. See page 209 of the manual.

– Marijn
Feb 20 at 13:02













@Marijn Using usepackage[noxcolor]{beamerarticle} allows me to compile everything as tikz standalone, but will only show the "last page" of each slide, instead of having several pages. Unfortunately, I cannot find this use caseto be detailed in the manual.

– FooBar
Feb 20 at 13:54







@Marijn Using usepackage[noxcolor]{beamerarticle} allows me to compile everything as tikz standalone, but will only show the "last page" of each slide, instead of having several pages. Unfortunately, I cannot find this use caseto be detailed in the manual.

– FooBar
Feb 20 at 13:54















How about standalone with standaloneframes, as e.g. in tex.stackexchange.com/a/168705/121799 ?

– marmot
Feb 20 at 14:58





How about standalone with standaloneframes, as e.g. in tex.stackexchange.com/a/168705/121799 ?

– marmot
Feb 20 at 14:58













@marmot Better, but pictures are not full scale in the page. Including the pdfs in other presentation will add unnecessary white space.

– FooBar
Feb 20 at 16:20







@marmot Better, but pictures are not full scale in the page. Including the pdfs in other presentation will add unnecessary white space.

– FooBar
Feb 20 at 16:20















Doesn't tex.stackexchange.com/a/168705/121799 specifically tell you how to include pictures of that sort? (Or are you just looking for an ordinary ifnum? See e.g. tex.stackexchange.com/a/459641/121799 for how to use it for drawing certain things only on certain "frames". Sometimes ifcase can be useful.)

– marmot
Feb 20 at 16:24





Doesn't tex.stackexchange.com/a/168705/121799 specifically tell you how to include pictures of that sort? (Or are you just looking for an ordinary ifnum? See e.g. tex.stackexchange.com/a/459641/121799 for how to use it for drawing certain things only on certain "frames". Sometimes ifcase can be useful.)

– marmot
Feb 20 at 16:24










1 Answer
1






active

oldest

votes


















4














UPDATE: standalone and beamer and only do work, just not with crop but with preview.



documentclass[beamer,tikz,preview]{standalone}
usepackage{pgfplots}
%usetikzlibrary{overlay-beamer-styles} % for advanced overlay options
pgfplotsset{compat=1.16}
begin{document}
begin{standaloneframe}
begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
only<2>{
addplot[blue, thick, dashed] {2*x};
}
end{axis}
end{tikzpicture}
end{standaloneframe}
end{document}


enter image description here



This becomes much simpler and better IMHO when using overlay-beamer-styles.



documentclass[beamer,tikz,preview]{standalone}
usepackage{pgfplots}
usetikzlibrary{overlay-beamer-styles} % for advanced overlay options
pgfplotsset{compat=1.16}
begin{document}
begin{standaloneframe}
begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
addplot[blue, thick, dashed,visible on=<2>] {2*x};
end{axis}
end{tikzpicture}
end{standaloneframe}
end{document}


enter image description here



OLD ANSWER (perhaps also useful for some applications, so I keep it for now): Maybe something like this? The role of beamers only is taken by ifnum.



documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
foreach X in {1,2}
{begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
ifnumX=2
addplot[blue, thick, dashed] {2*x};
fi
end{axis}
end{tikzpicture}}
end{document}


enter image description here



Of course, you can make much more elaborate examples. Just like in beamer presentations with only, a multipage pdf is generated. Here, however, the figures are cropped at their bounding boxes.



Of course, in a real example you may want to make sure that the coordinates do not jump, e.g. with



documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
foreach X in {1,2}
{begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
ifnumX=2
addplot[blue, thick, dashed] {2*x};
else
addplot[blue, thick, dashed,opacity=0] {2*x};
fi
end{axis}
end{tikzpicture}}
end{document}


enter image description here






share|improve this answer


























  • This does what I wanted, albeit I find ifnum to be a lot of overhead. I'd still be interested in a generic solution that directly allows the beamer tools such as alert<2> etc, which all can be done with this technique but generate quite messy documents

    – FooBar
    Feb 20 at 16:43











  • @FooBar You're right. I added a proposal that does precisely that. (I first tried using crop but this didn't work, yet preview does. Whether or not crop should work, I don't know.)

    – marmot
    Feb 20 at 17:39











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


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475822%2fusing-beamer-tools-in-tikz-without-creating-slides%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









4














UPDATE: standalone and beamer and only do work, just not with crop but with preview.



documentclass[beamer,tikz,preview]{standalone}
usepackage{pgfplots}
%usetikzlibrary{overlay-beamer-styles} % for advanced overlay options
pgfplotsset{compat=1.16}
begin{document}
begin{standaloneframe}
begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
only<2>{
addplot[blue, thick, dashed] {2*x};
}
end{axis}
end{tikzpicture}
end{standaloneframe}
end{document}


enter image description here



This becomes much simpler and better IMHO when using overlay-beamer-styles.



documentclass[beamer,tikz,preview]{standalone}
usepackage{pgfplots}
usetikzlibrary{overlay-beamer-styles} % for advanced overlay options
pgfplotsset{compat=1.16}
begin{document}
begin{standaloneframe}
begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
addplot[blue, thick, dashed,visible on=<2>] {2*x};
end{axis}
end{tikzpicture}
end{standaloneframe}
end{document}


enter image description here



OLD ANSWER (perhaps also useful for some applications, so I keep it for now): Maybe something like this? The role of beamers only is taken by ifnum.



documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
foreach X in {1,2}
{begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
ifnumX=2
addplot[blue, thick, dashed] {2*x};
fi
end{axis}
end{tikzpicture}}
end{document}


enter image description here



Of course, you can make much more elaborate examples. Just like in beamer presentations with only, a multipage pdf is generated. Here, however, the figures are cropped at their bounding boxes.



Of course, in a real example you may want to make sure that the coordinates do not jump, e.g. with



documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
foreach X in {1,2}
{begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
ifnumX=2
addplot[blue, thick, dashed] {2*x};
else
addplot[blue, thick, dashed,opacity=0] {2*x};
fi
end{axis}
end{tikzpicture}}
end{document}


enter image description here






share|improve this answer


























  • This does what I wanted, albeit I find ifnum to be a lot of overhead. I'd still be interested in a generic solution that directly allows the beamer tools such as alert<2> etc, which all can be done with this technique but generate quite messy documents

    – FooBar
    Feb 20 at 16:43











  • @FooBar You're right. I added a proposal that does precisely that. (I first tried using crop but this didn't work, yet preview does. Whether or not crop should work, I don't know.)

    – marmot
    Feb 20 at 17:39
















4














UPDATE: standalone and beamer and only do work, just not with crop but with preview.



documentclass[beamer,tikz,preview]{standalone}
usepackage{pgfplots}
%usetikzlibrary{overlay-beamer-styles} % for advanced overlay options
pgfplotsset{compat=1.16}
begin{document}
begin{standaloneframe}
begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
only<2>{
addplot[blue, thick, dashed] {2*x};
}
end{axis}
end{tikzpicture}
end{standaloneframe}
end{document}


enter image description here



This becomes much simpler and better IMHO when using overlay-beamer-styles.



documentclass[beamer,tikz,preview]{standalone}
usepackage{pgfplots}
usetikzlibrary{overlay-beamer-styles} % for advanced overlay options
pgfplotsset{compat=1.16}
begin{document}
begin{standaloneframe}
begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
addplot[blue, thick, dashed,visible on=<2>] {2*x};
end{axis}
end{tikzpicture}
end{standaloneframe}
end{document}


enter image description here



OLD ANSWER (perhaps also useful for some applications, so I keep it for now): Maybe something like this? The role of beamers only is taken by ifnum.



documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
foreach X in {1,2}
{begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
ifnumX=2
addplot[blue, thick, dashed] {2*x};
fi
end{axis}
end{tikzpicture}}
end{document}


enter image description here



Of course, you can make much more elaborate examples. Just like in beamer presentations with only, a multipage pdf is generated. Here, however, the figures are cropped at their bounding boxes.



Of course, in a real example you may want to make sure that the coordinates do not jump, e.g. with



documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
foreach X in {1,2}
{begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
ifnumX=2
addplot[blue, thick, dashed] {2*x};
else
addplot[blue, thick, dashed,opacity=0] {2*x};
fi
end{axis}
end{tikzpicture}}
end{document}


enter image description here






share|improve this answer


























  • This does what I wanted, albeit I find ifnum to be a lot of overhead. I'd still be interested in a generic solution that directly allows the beamer tools such as alert<2> etc, which all can be done with this technique but generate quite messy documents

    – FooBar
    Feb 20 at 16:43











  • @FooBar You're right. I added a proposal that does precisely that. (I first tried using crop but this didn't work, yet preview does. Whether or not crop should work, I don't know.)

    – marmot
    Feb 20 at 17:39














4












4








4







UPDATE: standalone and beamer and only do work, just not with crop but with preview.



documentclass[beamer,tikz,preview]{standalone}
usepackage{pgfplots}
%usetikzlibrary{overlay-beamer-styles} % for advanced overlay options
pgfplotsset{compat=1.16}
begin{document}
begin{standaloneframe}
begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
only<2>{
addplot[blue, thick, dashed] {2*x};
}
end{axis}
end{tikzpicture}
end{standaloneframe}
end{document}


enter image description here



This becomes much simpler and better IMHO when using overlay-beamer-styles.



documentclass[beamer,tikz,preview]{standalone}
usepackage{pgfplots}
usetikzlibrary{overlay-beamer-styles} % for advanced overlay options
pgfplotsset{compat=1.16}
begin{document}
begin{standaloneframe}
begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
addplot[blue, thick, dashed,visible on=<2>] {2*x};
end{axis}
end{tikzpicture}
end{standaloneframe}
end{document}


enter image description here



OLD ANSWER (perhaps also useful for some applications, so I keep it for now): Maybe something like this? The role of beamers only is taken by ifnum.



documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
foreach X in {1,2}
{begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
ifnumX=2
addplot[blue, thick, dashed] {2*x};
fi
end{axis}
end{tikzpicture}}
end{document}


enter image description here



Of course, you can make much more elaborate examples. Just like in beamer presentations with only, a multipage pdf is generated. Here, however, the figures are cropped at their bounding boxes.



Of course, in a real example you may want to make sure that the coordinates do not jump, e.g. with



documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
foreach X in {1,2}
{begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
ifnumX=2
addplot[blue, thick, dashed] {2*x};
else
addplot[blue, thick, dashed,opacity=0] {2*x};
fi
end{axis}
end{tikzpicture}}
end{document}


enter image description here






share|improve this answer















UPDATE: standalone and beamer and only do work, just not with crop but with preview.



documentclass[beamer,tikz,preview]{standalone}
usepackage{pgfplots}
%usetikzlibrary{overlay-beamer-styles} % for advanced overlay options
pgfplotsset{compat=1.16}
begin{document}
begin{standaloneframe}
begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
only<2>{
addplot[blue, thick, dashed] {2*x};
}
end{axis}
end{tikzpicture}
end{standaloneframe}
end{document}


enter image description here



This becomes much simpler and better IMHO when using overlay-beamer-styles.



documentclass[beamer,tikz,preview]{standalone}
usepackage{pgfplots}
usetikzlibrary{overlay-beamer-styles} % for advanced overlay options
pgfplotsset{compat=1.16}
begin{document}
begin{standaloneframe}
begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
addplot[blue, thick, dashed,visible on=<2>] {2*x};
end{axis}
end{tikzpicture}
end{standaloneframe}
end{document}


enter image description here



OLD ANSWER (perhaps also useful for some applications, so I keep it for now): Maybe something like this? The role of beamers only is taken by ifnum.



documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
foreach X in {1,2}
{begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
ifnumX=2
addplot[blue, thick, dashed] {2*x};
fi
end{axis}
end{tikzpicture}}
end{document}


enter image description here



Of course, you can make much more elaborate examples. Just like in beamer presentations with only, a multipage pdf is generated. Here, however, the figures are cropped at their bounding boxes.



Of course, in a real example you may want to make sure that the coordinates do not jump, e.g. with



documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
foreach X in {1,2}
{begin{tikzpicture}
begin{axis}
addplot[blue, thick] {x};
ifnumX=2
addplot[blue, thick, dashed] {2*x};
else
addplot[blue, thick, dashed,opacity=0] {2*x};
fi
end{axis}
end{tikzpicture}}
end{document}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 20 at 17:35

























answered Feb 20 at 16:41









marmotmarmot

104k4123235




104k4123235













  • This does what I wanted, albeit I find ifnum to be a lot of overhead. I'd still be interested in a generic solution that directly allows the beamer tools such as alert<2> etc, which all can be done with this technique but generate quite messy documents

    – FooBar
    Feb 20 at 16:43











  • @FooBar You're right. I added a proposal that does precisely that. (I first tried using crop but this didn't work, yet preview does. Whether or not crop should work, I don't know.)

    – marmot
    Feb 20 at 17:39



















  • This does what I wanted, albeit I find ifnum to be a lot of overhead. I'd still be interested in a generic solution that directly allows the beamer tools such as alert<2> etc, which all can be done with this technique but generate quite messy documents

    – FooBar
    Feb 20 at 16:43











  • @FooBar You're right. I added a proposal that does precisely that. (I first tried using crop but this didn't work, yet preview does. Whether or not crop should work, I don't know.)

    – marmot
    Feb 20 at 17:39

















This does what I wanted, albeit I find ifnum to be a lot of overhead. I'd still be interested in a generic solution that directly allows the beamer tools such as alert<2> etc, which all can be done with this technique but generate quite messy documents

– FooBar
Feb 20 at 16:43





This does what I wanted, albeit I find ifnum to be a lot of overhead. I'd still be interested in a generic solution that directly allows the beamer tools such as alert<2> etc, which all can be done with this technique but generate quite messy documents

– FooBar
Feb 20 at 16:43













@FooBar You're right. I added a proposal that does precisely that. (I first tried using crop but this didn't work, yet preview does. Whether or not crop should work, I don't know.)

– marmot
Feb 20 at 17:39





@FooBar You're right. I added a proposal that does precisely that. (I first tried using crop but this didn't work, yet preview does. Whether or not crop should work, I don't know.)

– marmot
Feb 20 at 17:39


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475822%2fusing-beamer-tools-in-tikz-without-creating-slides%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

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?