TransWikia.com

Force wide Tikz figure to move left

TeX - LaTeX Asked on February 19, 2021

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.

2 Answers

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}

Correct answer by Zarko on February 19, 2021

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}

Answered by Eric Detienne on February 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP