[Tex/LaTex] How to draw angled lines in LaTeX to create ruled template for calligraphy

colorcoordinatesline-spacingtikz-anglestikz-pgf

I am trying to create a template for calligraphy writing. I would like it to look something like this picture below, but with no margins nor title (A4 paper). I want to have three types of lines:

  1. Horizontal lines alternating every 1 cm, dark black color.
  2. Horizontal lines alternating every 0.5 cm, light gray color. They will basically be in between the black 1 cm lines.
  3. Lines at an angle of 55 degrees alternating every 1 cm, red color. It would also be nice if that angle is a variable so that I can change it later if needed.

    Enter image description here


This is what I was able to do so far, but since I am drawing lines based on a rectangular coordinate system, I do not know how to adjust the angle of the sloped lines to be 55 degrees. I basically only need to fix that; otherwise, I am satisfied with my outcome.


\documentclass[letterpaper]{article} %do not include "draft" in order to render pictures
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{verbatim}

\begin{document}
\pagestyle{empty}

\begin{tikzpicture}[remember picture,overlay]

\foreach \i in {1,2,3,...,30}{
    \draw[black] ($(current page.north west)+(0,-\i)$) -- ($(current page.north east)+(0,-\i)$);}

\foreach \i in {0.5,1.5,2.5,...,60}{
    \draw[lightgray] ($(current page.north west)+(0,-\i)$) -- ($(current page.north east)+(0,-\i)$);}

\foreach \i in {1,2,3,...,60}{
    \draw[red] ($(current page.south west)+(0,-\i)$) -- ($(current page.north east)+(0,-\i)$);}

\foreach \i in {0,1,2,3,...,60}{
    \draw[red] ($(current page.south west)+(0,+\i)$) -- ($(current page.north east)+(0,+\i)$);}

\end{tikzpicture}

\end{document}

This is my output.

Enter image description here

Best Answer

You can use polar coordinates such as (55:100cm). In the code below, I compute the precise number of oblique lines to draw in function of the chosen angle \myAngle and the distance \myDist between two consecutive oblique lines. My code also computes the largest length needed for these lines.

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\pagestyle{empty}

\newcommand*{\myDist}{1cm} % distance between consecutive oblique lines
\newcommand*{\myAngle}{55} % angle of said lines wrt horizontal, in degrees
% Distance between consecutive oblique lines, projected on the horizontal axis
\pgfmathsetlengthmacro{\horizIntervWidth}{\myDist/sin(\myAngle)}

% Length of the longest oblique lines we'll need. I add 10pt to be 100% safe
% with respect to rounding errors (the lines will be clipped anyway).
\pgfmathsetlengthmacro{\maxLength}{10pt + \paperheight/sin(\myAngle)}

% Number of oblique lines to draw
\pgfmathtruncatemacro{\maxIndex}{
  round((\paperheight/tan(\myAngle) + \paperwidth)/\horizIntervWidth)}

\begin{document}

\begin{tikzpicture}[remember picture, overlay]
% Just to be sure we don't paint outside the page. :-)
\clip (current page.south west) rectangle (current page.north east);

\foreach \i in {1,2,...,30} {
  \draw[black] ($(current page.north west)+(0,-\i)$) --
               ($(current page.north east)+(0,-\i)$);
}

\foreach \i in {0.5,1.5,...,60} {
  \draw[lightgray] ($(current page.north west)+(0,-\i)$) --
                   ($(current page.north east)+(0,-\i)$);
}

\foreach \i in {1,2,...,\maxIndex} {
  \draw[red] ([xshift=-\i*\horizIntervWidth]current page.south east) --
            +(\myAngle:\maxLength);
}
\end{tikzpicture}

\end{document}

enter image description here

Related Question