I'm trying to make two Tikzpictures side by side, but I am not sure why it is going off the page in Tikzpicture...

Image showing one tikzpicture going off the page

Here is my code:


  \foreach \X in {0,...,#1}
   {\node[bullet,label={right:$\boldsymbol{(2,\X)}$}] (v2\X) at 
   \node[bullet,label={left:$\boldsymbol{(1,\X)}$}] (v1\X) at 
  \foreach \X [evaluate=\X as \NextX using {int(mod(\X+3,\mymod))},
  evaluate=\X as \AnotherX using {int(mod(\X+1,\mymod))},] in {0,...,#1}
  {\draw[thick] (v1\X) -- (v2\NextX);
  \draw[dashed] (v1\X) -- (v2\AnotherX);
  \draw (v1\X) -- (v2\X);} 

\begin{tikzpicture}[bullet/.style={circle,inner sep=2pt,fill}]


  • 4
    Don't use \hspace in a TikZ picture. Try \begin{scope}[xshift=5cm] ... \end{scope} instead.
    – user156344
    Mar 3, 2019 at 4:15
  • 3
    Notice also that in the pic version, i.e. in the lower code, of tex.stackexchange.com/a/477179/121799 you can just shift the corresponding pic and do not have to add a scope environment. That is, you can simply say \pic[xshift=5cm]{<name of the pic>};.
    – user121799
    Mar 3, 2019 at 4:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.