1

i'm using tikz to draw a diagram. But i meet the problem: latex place the tikzpicture with a distant to left edge of paper and its too large that goes over right edge. Like the picture below shows, theres still plenty of space at left corner, and right part of picture already gose out of page. I have done nothing than simply write:

\begin{figure}[!h]
    \centering
    \begin{tikzpicture}[square/.style={regular polygon,regular polygon sides=4}]
     %draw something large here
    \end{tikzpicture}
 \end{figure}

how can i place it correctly?

the compilable code can be found here: https://pastebin.com/H2NGYtKV Or by Overleaf: https://www.overleaf.com/read/hhxjmxdkvscg enter image description here

  • You have certainly done more that this, because the code you posted does not compile. – AlexG Apr 16 '18 at 11:46
  • well, if u insist to see the whole code, here it is: pastebin.com/H2NGYtKV – user152531 Apr 16 '18 at 11:50
  • The tikzpicture is too large to fit within \textwidth. The white margin on the left is the usual document margin. There is no a3paper option for the article class. See the *.log file. – AlexG Apr 16 '18 at 12:01
  • so how can i adjust it? other than use resizebox (what i currently use) – user152531 Apr 16 '18 at 13:06
  • ok... i used geometry to adjust margin \geometry{ a3paper, left=2mm, top=20mm, } and the problem is resolved – user152531 Apr 16 '18 at 13:19
1

So i have solved it myself by using geometry package and combined it with resizebox:

\documentclass[12pt,ngerman,landscape]{article}
...
\usepackage{geometry}
\geometry{
         left=2mm,
         top=20mm,
         right=2mm,
}

\begin{document}
\begin{figure}[!h]
    \centering
    \resizebox{\linewidth}{!}{
    \begin{tikzpicture}[square/.style={regular polygon,regular polygon sides=4}]
         %% codes gose here
    \end{tikzpicture}}
\end{figure}
\end{document}

As the result, it uses the full space from left edge to right edge.

The compilable Code can be find here: https://www.overleaf.com/read/hhxjmxdkvscg

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.