Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to make an origami template in tikz. I've made a latex document with 0.5cm margins on all 4 sides. Here is my tikz code:

\documentclass[landscape,a4paper]{article}

\usepackage[top=0.5cm, bottom=0.5cm, left=0.5cm, right=0.5cm]{geometry}

\usepackage{float}
\usepackage{graphics}
\usepackage{graphicx}

\usepackage{graphicx}

\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{figure}
  \centering
  \begin{tikzpicture}
  % \draw (0,0) rectangle (28.7cm,20cm);

    \draw (14.45, 4.9) -- (14.6, 17.0);
    \draw (14.6, 17.0) -- (26.5, 16.8);
    \draw (26.5, 16.8) -- (26.4, 4.7);
    \draw (26.4, 4.7)  -- (20.43, 4.1);
    \draw (20.43, 4.1) -- (14.45, 4.9);

    \draw (20.43, 4.1) -- (14.6, 17.0);
    \draw (20.43, 4.1) -- (26.5, 16.8);

    \draw (14.6, 17)   -- (2.7, 17.2);
    \draw (2.7, 17.2)  -- (2.6, 5.1);
    \draw (2.6, 5.1)   -- (8.47, 4.3);
    \draw (8.47, 4.3)  -- (14.45, 4.9);

    \draw (8.47, 4.3)  -- (2.7, 17.2);
    \draw (8.47, 4.3)  -- (14.6, 17.0);

    \draw (2.6, 5.1)   -- (1.3, 5.4);
    \draw (1.3, 5.4)   -- (1.4, 14.5);
    \draw (1.4, 14.5)  -- (2.7, 17.2);

    \draw (8.47, 4.3)  -- (8.7, 0.4);
    \draw (8.7, 0.4)   -- (10.65, 0.6);
    \draw (10.65, 0.6) -- (10.55, 1.5);
    \draw (10.55, 1.5) -- (12.99, 1.7);
    \draw (12.99, 1.7) -- (13.05, 0.86);
    \draw (13.05, 0.86) -- (14.97, 1.1);
    \draw (14.97, 1.1) -- (14.45, 4.9);

    \draw (14.45, 4.9) -- (17.18, 2.59);
    \draw (17.18, 2.59) -- (15.99, 1.95);
    \draw (15.99, 1.95) -- (15.97, 1.48);
    \draw (15.97, 1.48) -- (20.08, 1.10);
    \draw (20.08, 1.10) -- (20.43, 4.1);

    \draw (20.43, 4.1) -- (22.56, 1.24);
    \draw (22.56, 1.24) -- (22.69, 0.11);
    \draw (22.69, 0.11) -- (25.04, 0.44);
    \draw (25.04, 0.44) -- (24.93, 1.48);
    \draw (24.93, 1.48) -- (26.4, 4.7);

    \draw (2.6, 5.1) -- (2.08, 2.06);
    \draw (2.08, 2.06) -- (6.1, 1.35);
    \draw (6.1, 1.35) -- (6.15, 1.82);
    \draw (6.15, 1.82) -- (5.31, 2.77);
    \draw (5.31, 2.77) -- (8.47, 4.3);

    \node (mid) at (14.6, 17.0);
    \node (rh) at (20.48, 18.5);
    \node (r) at (26.5, 16.8);
    \node (lh) at (8.38, 18.63);
    \node (l) at (2.7, 17.2);

    \path (mid) edge [out=80,in=145,bend angle=180,looseness=1.45] (rh);
    \path (r) edge [out=96,in=35,bend angle=180,looseness=1.4] (rh);

    \path (mid) edge [out=100,in=35,bend angle=180,looseness=1.35] (lh);
    \path (l) edge [out=86,in=145,bend angle=180,looseness=1.45] (lh);
  \end{tikzpicture}
\end{figure}

\end{document}

which produces the following page: enter image description here

If you look, the whole image seems to be shifted down. I have a commented out rectangle at the start of my tikz code that should put a border around the printable area.

If I comment out the last 4 lines (the curved lines), then the tikz picture is in the correct place.

I'm not too worried about precise scale, what I really want is for this to be as large as possible on the page - i.e. the top and bottom of the image should touch the margin of the page.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

use a zero length for top and bottom.

\documentclass[landscape,a4paper]{article}
\usepackage[top=0cm, bottom=0cm, left=0.5cm, right=0.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\noindent
  \begin{tikzpicture}
    \draw (0,0) rectangle (28.7cm,20cm);
    \draw (14.45, 4.9) -- (14.6, 17.0);
    \draw (14.6, 17.0) -- (26.5, 16.8);
    \draw (26.5, 16.8) -- (26.4, 4.7);
    \draw (26.4, 4.7)  -- (20.43, 4.1);
    \draw (20.43, 4.1) -- (14.45, 4.9);

    \draw (20.43, 4.1) -- (14.6, 17.0);
    \draw (20.43, 4.1) -- (26.5, 16.8);

    \draw (14.6, 17)   -- (2.7, 17.2);
    \draw (2.7, 17.2)  -- (2.6, 5.1);
    \draw (2.6, 5.1)   -- (8.47, 4.3);
    \draw (8.47, 4.3)  -- (14.45, 4.9);

    \draw (8.47, 4.3)  -- (2.7, 17.2);
    \draw (8.47, 4.3)  -- (14.6, 17.0);

    \draw (2.6, 5.1)   -- (1.3, 5.4);
    \draw (1.3, 5.4)   -- (1.4, 14.5);
    \draw (1.4, 14.5)  -- (2.7, 17.2);

    \draw (8.47, 4.3)  -- (8.7, 0.4);
    \draw (8.7, 0.4)   -- (10.65, 0.6);
    \draw (10.65, 0.6) -- (10.55, 1.5);
    \draw (10.55, 1.5) -- (12.99, 1.7);
    \draw (12.99, 1.7) -- (13.05, 0.86);
    \draw (13.05, 0.86) -- (14.97, 1.1);
    \draw (14.97, 1.1) -- (14.45, 4.9);

    \draw (14.45, 4.9) -- (17.18, 2.59);
    \draw (17.18, 2.59) -- (15.99, 1.95);
    \draw (15.99, 1.95) -- (15.97, 1.48);
    \draw (15.97, 1.48) -- (20.08, 1.10);
    \draw (20.08, 1.10) -- (20.43, 4.1);

    \draw (20.43, 4.1) -- (22.56, 1.24);
    \draw (22.56, 1.24) -- (22.69, 0.11);
    \draw (22.69, 0.11) -- (25.04, 0.44);
    \draw (25.04, 0.44) -- (24.93, 1.48);
    \draw (24.93, 1.48) -- (26.4, 4.7);

    \draw (2.6, 5.1) -- (2.08, 2.06);
    \draw (2.08, 2.06) -- (6.1, 1.35);
    \draw (6.1, 1.35) -- (6.15, 1.82);
    \draw (6.15, 1.82) -- (5.31, 2.77);
    \draw (5.31, 2.77) -- (8.47, 4.3);

    \node (mid) at (14.6, 17.0){};
    \node (rh) at (20.48, 18.5){};
    \node (r) at (26.5, 16.8){};
    \node (lh) at (8.38, 18.63){};
    \node (l) at (2.7, 17.2){};

    \path (mid) edge [out=80,in=145,bend angle=180,looseness=1.45] (rh);
    \path (r) edge [out=96,in=35,bend angle=180,looseness=1.4] (rh);

    \path (mid) edge [out=100,in=35,bend angle=180,looseness=1.35] (lh);
    \path (l) edge [out=86,in=145,bend angle=180,looseness=1.45] (lh);
  \end{tikzpicture}%
\end{document}

it looks like that tikz have some trailing spaces. However, here is the output of my code:

enter image description here

share|improve this answer
    
Actually I had to set it to -0.5 for it to work for me, but thanks! This solved my problem! (albeit in probably the hackiest way possible). –  Folder97723 Jan 23 at 10:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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