2

I created a Figure consisting of 2 Tikz pictures. However, the two TikZ pictures are not correctly centered and are placed further on the right side of the page than they should be (see uploaded image).

The relevant part of my code looks as follows:

\begin{figure}
\centering
\sidesubfloat[]{
\begin{tikzpicture}[framed,scale=0.5,rotate=90,yscale=-1]
[....]
\end{tikzpicture}} 
\sidesubfloat[]{
\begin{tikzpicture}[framed,scale=0.5,rotate=90,yscale=-1]
[....]
\end{tikzpicture} }
\end{figure}

enter image description here

Stefan Pinnow
  • 29,535
aymi
  • 95
  • just ignore the third figure below the other two^^ – aymi Dec 25 '16 at 19:12
  • 7
    It seems to me that the first two figures together are wider than the \textwidth, so the second one sticks in the margin. – Pieter van Oostrum Dec 25 '16 at 19:18
  • Add \usepackage{showframe} to check Piet van Oostrum's hypothesis. – Bernard Dec 25 '16 at 19:53
  • 2
    you haven't shown your input, you haven't shown any over full warnings tex might have made, how do you expect anyone to debug this? (although you do have a word space to the left of the figures and not to the right, I agree with Piet it looks like the figures are too big. try height=.4\textwidth instead of scale=0.5 – David Carlisle Dec 25 '16 at 20:06
  • @DavidCarlisle You can't set the total width of tikzpictures like that though, so perhaps scale=0.4. – Torbjørn T. Dec 25 '16 at 21:34
  • You might need begin{tikzpicture}[overlay,... if you do not mind violating some typographical rules. – Symbol 1 Dec 26 '16 at 06:53
  • @Symbol1 How would overlay help here? – Torbjørn T. Dec 26 '16 at 12:54
  • @TorbjørnT. With \[\tikz[overlay]\node{\includegraphics{...}};\] the figure will be centered no matter how wide it is. – Symbol 1 Dec 26 '16 at 13:41
  • @Symbol1 Well, yes, but what makes you think the only thing in the tikzpictures is a \node with an image? And further it appears there are two tikzpictures side by side with the second one sticking into the right margin, and overlay wont do any good in that case. – Torbjørn T. Dec 26 '16 at 14:36
  • @TorbjørnT. In that case, put two graphics in one node or write\tikz\path node[left]{...}node[right]{...};. The point is that \tikz[overlay]... does a lot of job that used to be possible only if one plays with TeX primitives. – Symbol 1 Dec 27 '16 at 01:14
  • @Symbol1 Again, what makes you think the only thing in the tikzpictures is a \node with an image? (You could be right, but from the information given it's not an assumption I would make.) – Torbjørn T. Dec 27 '16 at 08:02
  • @aymi The best solution is probably to make the diagrams smaller, as mentioned above, but for centering \makebox or the adjustbox environment as in http://tex.stackexchange.com/a/39436/586 would likely do (i.e. add \usepackage{adjustbox} and put both subfloats between \begin{adjustbox}{center} and \end{adjustbox}). – Torbjørn T. Dec 27 '16 at 08:05
  • Did you figure this out? As David said in his comment, there really isn't enough information to accurately diagnose the problem, though the guesses above may well be correct. – Torbjørn T. Jan 19 '17 at 09:02

0 Answers0