Problems with position of tikzpictures in beamerHow to define the default vertical distance between...

Coworker asking me to not bring cakes due to self control issue. What should I do?

How can I handle players killing my NPC outside of combat?

What is wrong with my use of "find -print0"?

Why would you use 2 alternate layout buttons instead of 1, when only one can be selected at once

What does "south of due west" mean?

In a post apocalypse world, with no power and few survivors, would Satnav still work?

In the Lost in Space intro why was Dr. Smith actor listed as a special guest star?

What is the smallest molar volume?

How do I add a strong "onion flavor" to the biryani (in restaurant style)?

Manager has noticed coworker's excessive breaks. Should I warn him?

What does "move past people" mean in this context?

Will the duration of traveling to Ceres using the same tech developed for going to Mars be proportional to the distance to go to Mars or not?

What could cause an entire planet of humans to become aphasic?

Can't figure out a htaccess rule

Is the Maximum Use License for Everybody (MULE) a FOSS license?

Converting numbers to words - Python

Is Screenshot Time-tracking Common?

1990s-2000s horror alien movie with slugs infecting people through the mouth

How many copper coins fit inside a cubic foot?

Question Tag error

Boss asked me to sign a resignation paper without a date on it along with my new contract

Two oatmeal pies a day keep the doctor away?

Does Plato's "Ring of Gyges" have a corrupting influence on its wearer?

Was the Spartan by Mimic Systems a real product?



Problems with position of tikzpictures in beamer


How to define the default vertical distance between nodes?Numerical conditional within tikz keys?Get access to beamer palette for tikzpicturesPosition tikzpictures side by sideLaTeX/Beamer problems with themeTikZ: Problems with relative positionProblems with nested TikZpicturesLaTeX beamer: pagenumbering appendixabsolute position of tikzpicture in beamerbeamer + tikz box position













2















Consider the following MWE:



documentclass{beamer}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{tikz,alphalph,amsmath}
setbeamertemplate{navigation symbols}{}
usetheme{AnnArbor}
usecolortheme{dolphin}
setbeamercolor{frametitle}{fg=structure,bg=white}
setbeamerfont{frametitle}{shape=rmbfseries}
newcommand{caesar}[1]{
centering
begin{tikzpicture}[every node/.style={draw,minimum width=1cm,minimum height=1cm}]
foreach k in {1,...,26}
{
pgfmathsetmacrosecure{int(k+#1)}
ifnumk=26
pgfmathsetmacromainx{mod(k,26)}
else
pgfmathsetmacromainx{mod(k,26)-1}
fi
pgfmathsetmacroxpos{mod(mainx,5)}
pgfmathsetmacrotestnumber{mod(k,5)}

ifcasetestnumber=0
pgfmathsetmacroypos{-floor(k/5)+1}
else
pgfmathsetmacroypos{-floor(k/5)}
fi


pgfmathsetmacroletter{int(mod(secure,26))}
ifnumletter=0
pgfmathsetmacroletter{26}
elsefi

node at (xpos,ypos) {strutalphalph{letter}};
}

node[draw=none] at (7,0) {$(x+textcolor{red}{e})mod 26$ mit $textcolor{red}{e} = #1$};
end{tikzpicture}
}
begin{document}
title{bf Title}
author{Name}
institute{Institute}
maketitle

begin{frame}{Cäsar-Verschlüsselung}
only<1>{
caesar{0}
}
only<2>{
caesar{1}
}
end{frame}
end{document}


Screenshot



As you see, the position of the tikzpicture in the third frame is different from the second one (it's a little bit shifted to the right). I guess it's related a kind of the boxes, which the package alphalph uses for the letters of sth. like that.



My questions is: How can I fix this "bug" (in meaning of that there is no shifting when the third frame appears)?










share|improve this question


















  • 1





    Set both tikzpictures to use the same size for their bounding box (use as bounding box option).

    – Skillmon
    2 hours ago
















2















Consider the following MWE:



documentclass{beamer}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{tikz,alphalph,amsmath}
setbeamertemplate{navigation symbols}{}
usetheme{AnnArbor}
usecolortheme{dolphin}
setbeamercolor{frametitle}{fg=structure,bg=white}
setbeamerfont{frametitle}{shape=rmbfseries}
newcommand{caesar}[1]{
centering
begin{tikzpicture}[every node/.style={draw,minimum width=1cm,minimum height=1cm}]
foreach k in {1,...,26}
{
pgfmathsetmacrosecure{int(k+#1)}
ifnumk=26
pgfmathsetmacromainx{mod(k,26)}
else
pgfmathsetmacromainx{mod(k,26)-1}
fi
pgfmathsetmacroxpos{mod(mainx,5)}
pgfmathsetmacrotestnumber{mod(k,5)}

ifcasetestnumber=0
pgfmathsetmacroypos{-floor(k/5)+1}
else
pgfmathsetmacroypos{-floor(k/5)}
fi


pgfmathsetmacroletter{int(mod(secure,26))}
ifnumletter=0
pgfmathsetmacroletter{26}
elsefi

node at (xpos,ypos) {strutalphalph{letter}};
}

node[draw=none] at (7,0) {$(x+textcolor{red}{e})mod 26$ mit $textcolor{red}{e} = #1$};
end{tikzpicture}
}
begin{document}
title{bf Title}
author{Name}
institute{Institute}
maketitle

begin{frame}{Cäsar-Verschlüsselung}
only<1>{
caesar{0}
}
only<2>{
caesar{1}
}
end{frame}
end{document}


Screenshot



As you see, the position of the tikzpicture in the third frame is different from the second one (it's a little bit shifted to the right). I guess it's related a kind of the boxes, which the package alphalph uses for the letters of sth. like that.



My questions is: How can I fix this "bug" (in meaning of that there is no shifting when the third frame appears)?










share|improve this question


















  • 1





    Set both tikzpictures to use the same size for their bounding box (use as bounding box option).

    – Skillmon
    2 hours ago














2












2








2








Consider the following MWE:



documentclass{beamer}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{tikz,alphalph,amsmath}
setbeamertemplate{navigation symbols}{}
usetheme{AnnArbor}
usecolortheme{dolphin}
setbeamercolor{frametitle}{fg=structure,bg=white}
setbeamerfont{frametitle}{shape=rmbfseries}
newcommand{caesar}[1]{
centering
begin{tikzpicture}[every node/.style={draw,minimum width=1cm,minimum height=1cm}]
foreach k in {1,...,26}
{
pgfmathsetmacrosecure{int(k+#1)}
ifnumk=26
pgfmathsetmacromainx{mod(k,26)}
else
pgfmathsetmacromainx{mod(k,26)-1}
fi
pgfmathsetmacroxpos{mod(mainx,5)}
pgfmathsetmacrotestnumber{mod(k,5)}

ifcasetestnumber=0
pgfmathsetmacroypos{-floor(k/5)+1}
else
pgfmathsetmacroypos{-floor(k/5)}
fi


pgfmathsetmacroletter{int(mod(secure,26))}
ifnumletter=0
pgfmathsetmacroletter{26}
elsefi

node at (xpos,ypos) {strutalphalph{letter}};
}

node[draw=none] at (7,0) {$(x+textcolor{red}{e})mod 26$ mit $textcolor{red}{e} = #1$};
end{tikzpicture}
}
begin{document}
title{bf Title}
author{Name}
institute{Institute}
maketitle

begin{frame}{Cäsar-Verschlüsselung}
only<1>{
caesar{0}
}
only<2>{
caesar{1}
}
end{frame}
end{document}


Screenshot



As you see, the position of the tikzpicture in the third frame is different from the second one (it's a little bit shifted to the right). I guess it's related a kind of the boxes, which the package alphalph uses for the letters of sth. like that.



My questions is: How can I fix this "bug" (in meaning of that there is no shifting when the third frame appears)?










share|improve this question














Consider the following MWE:



documentclass{beamer}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{tikz,alphalph,amsmath}
setbeamertemplate{navigation symbols}{}
usetheme{AnnArbor}
usecolortheme{dolphin}
setbeamercolor{frametitle}{fg=structure,bg=white}
setbeamerfont{frametitle}{shape=rmbfseries}
newcommand{caesar}[1]{
centering
begin{tikzpicture}[every node/.style={draw,minimum width=1cm,minimum height=1cm}]
foreach k in {1,...,26}
{
pgfmathsetmacrosecure{int(k+#1)}
ifnumk=26
pgfmathsetmacromainx{mod(k,26)}
else
pgfmathsetmacromainx{mod(k,26)-1}
fi
pgfmathsetmacroxpos{mod(mainx,5)}
pgfmathsetmacrotestnumber{mod(k,5)}

ifcasetestnumber=0
pgfmathsetmacroypos{-floor(k/5)+1}
else
pgfmathsetmacroypos{-floor(k/5)}
fi


pgfmathsetmacroletter{int(mod(secure,26))}
ifnumletter=0
pgfmathsetmacroletter{26}
elsefi

node at (xpos,ypos) {strutalphalph{letter}};
}

node[draw=none] at (7,0) {$(x+textcolor{red}{e})mod 26$ mit $textcolor{red}{e} = #1$};
end{tikzpicture}
}
begin{document}
title{bf Title}
author{Name}
institute{Institute}
maketitle

begin{frame}{Cäsar-Verschlüsselung}
only<1>{
caesar{0}
}
only<2>{
caesar{1}
}
end{frame}
end{document}


Screenshot



As you see, the position of the tikzpicture in the third frame is different from the second one (it's a little bit shifted to the right). I guess it's related a kind of the boxes, which the package alphalph uses for the letters of sth. like that.



My questions is: How can I fix this "bug" (in meaning of that there is no shifting when the third frame appears)?







tikz-pgf beamer positioning






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 hours ago









current_usercurrent_user

3,4201637




3,4201637








  • 1





    Set both tikzpictures to use the same size for their bounding box (use as bounding box option).

    – Skillmon
    2 hours ago














  • 1





    Set both tikzpictures to use the same size for their bounding box (use as bounding box option).

    – Skillmon
    2 hours ago








1




1





Set both tikzpictures to use the same size for their bounding box (use as bounding box option).

– Skillmon
2 hours ago





Set both tikzpictures to use the same size for their bounding box (use as bounding box option).

– Skillmon
2 hours ago










1 Answer
1






active

oldest

votes


















4














The actual reason is way simpler. You included spurious spaces with the way you used only which lead to the shift. You have to make sure to comment out line endings using %:



documentclass{beamer}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{tikz,alphalph,amsmath}
setbeamertemplate{navigation symbols}{}
usetheme{AnnArbor}
usecolortheme{dolphin}
setbeamercolor{frametitle}{fg=structure,bg=white}
setbeamerfont{frametitle}{shape=rmbfseries}
newcommand{caesar}[1]{
centering
begin{tikzpicture}[every node/.style={draw,minimum width=1cm,minimum height=1cm}]
foreach k in {1,...,26}
{
pgfmathsetmacrosecure{int(k+#1)}
ifnumk=26
pgfmathsetmacromainx{mod(k,26)}
else
pgfmathsetmacromainx{mod(k,26)-1}
fi
pgfmathsetmacroxpos{mod(mainx,5)}
pgfmathsetmacrotestnumber{mod(k,5)}

ifcasetestnumber=0
pgfmathsetmacroypos{-floor(k/5)+1}
else
pgfmathsetmacroypos{-floor(k/5)}
fi


pgfmathsetmacroletter{int(mod(secure,26))}
ifnumletter=0
pgfmathsetmacroletter{26}
elsefi

node at (xpos,ypos) {strutmakebox[1em]{alphalph{letter}}};
}

node[draw=none] at (7,0) {$(x+textcolor{red}{e})mod 26$ mit $textcolor{red}{e} = #1$};
end{tikzpicture}
}
begin{document}
title{bf Title}
author{Name}
institute{Institute}
maketitle

begin{frame}{Cäsar-Verschlüsselung}
only<1>{%
caesar{0}%
}%
only<2>{%
caesar{1}%
}%
end{frame}
end{document}


enter image description here






share|improve this answer























    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%2f476308%2fproblems-with-position-of-tikzpictures-in-beamer%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














    The actual reason is way simpler. You included spurious spaces with the way you used only which lead to the shift. You have to make sure to comment out line endings using %:



    documentclass{beamer}
    usepackage[utf8]{inputenc}
    usepackage[T1]{fontenc}
    usepackage[ngerman]{babel}
    usepackage{tikz,alphalph,amsmath}
    setbeamertemplate{navigation symbols}{}
    usetheme{AnnArbor}
    usecolortheme{dolphin}
    setbeamercolor{frametitle}{fg=structure,bg=white}
    setbeamerfont{frametitle}{shape=rmbfseries}
    newcommand{caesar}[1]{
    centering
    begin{tikzpicture}[every node/.style={draw,minimum width=1cm,minimum height=1cm}]
    foreach k in {1,...,26}
    {
    pgfmathsetmacrosecure{int(k+#1)}
    ifnumk=26
    pgfmathsetmacromainx{mod(k,26)}
    else
    pgfmathsetmacromainx{mod(k,26)-1}
    fi
    pgfmathsetmacroxpos{mod(mainx,5)}
    pgfmathsetmacrotestnumber{mod(k,5)}

    ifcasetestnumber=0
    pgfmathsetmacroypos{-floor(k/5)+1}
    else
    pgfmathsetmacroypos{-floor(k/5)}
    fi


    pgfmathsetmacroletter{int(mod(secure,26))}
    ifnumletter=0
    pgfmathsetmacroletter{26}
    elsefi

    node at (xpos,ypos) {strutmakebox[1em]{alphalph{letter}}};
    }

    node[draw=none] at (7,0) {$(x+textcolor{red}{e})mod 26$ mit $textcolor{red}{e} = #1$};
    end{tikzpicture}
    }
    begin{document}
    title{bf Title}
    author{Name}
    institute{Institute}
    maketitle

    begin{frame}{Cäsar-Verschlüsselung}
    only<1>{%
    caesar{0}%
    }%
    only<2>{%
    caesar{1}%
    }%
    end{frame}
    end{document}


    enter image description here






    share|improve this answer




























      4














      The actual reason is way simpler. You included spurious spaces with the way you used only which lead to the shift. You have to make sure to comment out line endings using %:



      documentclass{beamer}
      usepackage[utf8]{inputenc}
      usepackage[T1]{fontenc}
      usepackage[ngerman]{babel}
      usepackage{tikz,alphalph,amsmath}
      setbeamertemplate{navigation symbols}{}
      usetheme{AnnArbor}
      usecolortheme{dolphin}
      setbeamercolor{frametitle}{fg=structure,bg=white}
      setbeamerfont{frametitle}{shape=rmbfseries}
      newcommand{caesar}[1]{
      centering
      begin{tikzpicture}[every node/.style={draw,minimum width=1cm,minimum height=1cm}]
      foreach k in {1,...,26}
      {
      pgfmathsetmacrosecure{int(k+#1)}
      ifnumk=26
      pgfmathsetmacromainx{mod(k,26)}
      else
      pgfmathsetmacromainx{mod(k,26)-1}
      fi
      pgfmathsetmacroxpos{mod(mainx,5)}
      pgfmathsetmacrotestnumber{mod(k,5)}

      ifcasetestnumber=0
      pgfmathsetmacroypos{-floor(k/5)+1}
      else
      pgfmathsetmacroypos{-floor(k/5)}
      fi


      pgfmathsetmacroletter{int(mod(secure,26))}
      ifnumletter=0
      pgfmathsetmacroletter{26}
      elsefi

      node at (xpos,ypos) {strutmakebox[1em]{alphalph{letter}}};
      }

      node[draw=none] at (7,0) {$(x+textcolor{red}{e})mod 26$ mit $textcolor{red}{e} = #1$};
      end{tikzpicture}
      }
      begin{document}
      title{bf Title}
      author{Name}
      institute{Institute}
      maketitle

      begin{frame}{Cäsar-Verschlüsselung}
      only<1>{%
      caesar{0}%
      }%
      only<2>{%
      caesar{1}%
      }%
      end{frame}
      end{document}


      enter image description here






      share|improve this answer


























        4












        4








        4







        The actual reason is way simpler. You included spurious spaces with the way you used only which lead to the shift. You have to make sure to comment out line endings using %:



        documentclass{beamer}
        usepackage[utf8]{inputenc}
        usepackage[T1]{fontenc}
        usepackage[ngerman]{babel}
        usepackage{tikz,alphalph,amsmath}
        setbeamertemplate{navigation symbols}{}
        usetheme{AnnArbor}
        usecolortheme{dolphin}
        setbeamercolor{frametitle}{fg=structure,bg=white}
        setbeamerfont{frametitle}{shape=rmbfseries}
        newcommand{caesar}[1]{
        centering
        begin{tikzpicture}[every node/.style={draw,minimum width=1cm,minimum height=1cm}]
        foreach k in {1,...,26}
        {
        pgfmathsetmacrosecure{int(k+#1)}
        ifnumk=26
        pgfmathsetmacromainx{mod(k,26)}
        else
        pgfmathsetmacromainx{mod(k,26)-1}
        fi
        pgfmathsetmacroxpos{mod(mainx,5)}
        pgfmathsetmacrotestnumber{mod(k,5)}

        ifcasetestnumber=0
        pgfmathsetmacroypos{-floor(k/5)+1}
        else
        pgfmathsetmacroypos{-floor(k/5)}
        fi


        pgfmathsetmacroletter{int(mod(secure,26))}
        ifnumletter=0
        pgfmathsetmacroletter{26}
        elsefi

        node at (xpos,ypos) {strutmakebox[1em]{alphalph{letter}}};
        }

        node[draw=none] at (7,0) {$(x+textcolor{red}{e})mod 26$ mit $textcolor{red}{e} = #1$};
        end{tikzpicture}
        }
        begin{document}
        title{bf Title}
        author{Name}
        institute{Institute}
        maketitle

        begin{frame}{Cäsar-Verschlüsselung}
        only<1>{%
        caesar{0}%
        }%
        only<2>{%
        caesar{1}%
        }%
        end{frame}
        end{document}


        enter image description here






        share|improve this answer













        The actual reason is way simpler. You included spurious spaces with the way you used only which lead to the shift. You have to make sure to comment out line endings using %:



        documentclass{beamer}
        usepackage[utf8]{inputenc}
        usepackage[T1]{fontenc}
        usepackage[ngerman]{babel}
        usepackage{tikz,alphalph,amsmath}
        setbeamertemplate{navigation symbols}{}
        usetheme{AnnArbor}
        usecolortheme{dolphin}
        setbeamercolor{frametitle}{fg=structure,bg=white}
        setbeamerfont{frametitle}{shape=rmbfseries}
        newcommand{caesar}[1]{
        centering
        begin{tikzpicture}[every node/.style={draw,minimum width=1cm,minimum height=1cm}]
        foreach k in {1,...,26}
        {
        pgfmathsetmacrosecure{int(k+#1)}
        ifnumk=26
        pgfmathsetmacromainx{mod(k,26)}
        else
        pgfmathsetmacromainx{mod(k,26)-1}
        fi
        pgfmathsetmacroxpos{mod(mainx,5)}
        pgfmathsetmacrotestnumber{mod(k,5)}

        ifcasetestnumber=0
        pgfmathsetmacroypos{-floor(k/5)+1}
        else
        pgfmathsetmacroypos{-floor(k/5)}
        fi


        pgfmathsetmacroletter{int(mod(secure,26))}
        ifnumletter=0
        pgfmathsetmacroletter{26}
        elsefi

        node at (xpos,ypos) {strutmakebox[1em]{alphalph{letter}}};
        }

        node[draw=none] at (7,0) {$(x+textcolor{red}{e})mod 26$ mit $textcolor{red}{e} = #1$};
        end{tikzpicture}
        }
        begin{document}
        title{bf Title}
        author{Name}
        institute{Institute}
        maketitle

        begin{frame}{Cäsar-Verschlüsselung}
        only<1>{%
        caesar{0}%
        }%
        only<2>{%
        caesar{1}%
        }%
        end{frame}
        end{document}


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 hours ago









        SkillmonSkillmon

        22.6k11943




        22.6k11943






























            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%2f476308%2fproblems-with-position-of-tikzpictures-in-beamer%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

            Szabolcs (Ungheria) Altri progetti | Menu di navigazione48°10′14.56″N 21°29′33.14″E /...

            Discografia di Klaus Schulze Indice Album in studio | Album dal vivo | Singoli | Antologie | Colonne...

            How to make inet_server_addr() return localhost in spite of ::1/128RETURN NEXT in Postgres FunctionConnect to...