8

I want to force a tikz (wide) figure to go to the left, without changing anything (I don't want to resize or reshape it), I just want to use the wasted left part of the page. I already tried hbox*{-5cm} {...} (for example). It does not seem to work. I feel like there is something missing, how do I break the imposed left margin on the page?!

Thank you very much

Claude.

Karlo
  • 3,257
Claude
  • 187

2 Answers2

11

The package changepage can be your friend:

\begin{adjustwidth}{<leftmargin>}{<rightmargin>}

in one side documents and

\begin{adjustwidth*}{}{-8em}

(where -8em is width added to right margin of environment) for two side document. If you will provide MWE, I can show you an example of it use. In general you can do something like this:

\begin{figure}
\begin{adjustwidth*}{}{-8em} 
    \begin{tikzpicture}
    ...
    \end{tikzpicture}
\end{adjustwidth}
\end{figure}
Zarko
  • 296,517
1

I'm reluctant to add one more package, like "changepage", even if it perfectly works in my case. I much prefer to specify a "bounding box" using the tikz command "\useasboundingbox". Latex perfectly understands the limits of your figure and can easily center it, or align it to your left margin if you prefer. You only have to "calibrate" your bounding box properly, assuming that by default your drawing is centered on (0,0).

This leads, for instance, to the following code:

\begin{figure} % \centering if desired
  \begin{tikzpicture}
  \useasboundingbox (-6.0,-6.3) rectangle (6.0,9.5); % replace by \draw[blue,thick]
                                                 % to make the borders visible
...
\end{tikzpicture}
\end{figure}
  • Thanks for your contribution. It works with Beamer also, I don't think the changepage solution will. Could you explain me the meaning of this (-6.0,-6.3) rectangle (6.0,9.5) please ? And how to "make the borders visible" I didn't suceed in that too... – zetyty Feb 10 '22 at 14:39