Howto:Build graduate dials with LaTeX: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 108: Line 108:
This command defines a "node" and its content is defined within the braces. The node, in the TikZ language, is a box where you can insert something, such as the number ''33'', but you can do something else like lowering font ''{\small 33}'' and much more according to LaTeX syntax. Or you can rotate the string at an angle by placing this attribute: ''\draw (30,0.7) node [rotate = 90] {33};'' and so much more.
This command defines a "node" and its content is defined within the braces. The node, in the TikZ language, is a box where you can insert something, such as the number ''33'', but you can do something else like lowering font ''{\small 33}'' and much more according to LaTeX syntax. Or you can rotate the string at an angle by placing this attribute: ''\draw (30,0.7) node [rotate = 90] {33};'' and so much more.


==Circular graduate dials==
<syntaxhighlight lang="latex">
% Adriano Bassignana nov 2017
% Program for creating a linear index useful for the construction of a compass on a conical support
% The program can be modified and adapted for the construction of other types of numeric indexes.
% The font used is OCR-B which allows to have alphabetic and numeric symbols very similar
% to those used in analogue flight gauges in the 50s and 80s
% You must have installed OCR-B in OTF format that has a GPL-2 and later compatible license.
% The font is present in the texlive-fonts-extra package
%
% Explanation:
%
% \documentclass{standalone} is particular class that non have a size, but the size is define from
% the document itself
\documentclass{standalone}
% \usepackage{tikz} is the package that contain the graphics command as \draw etc ...
% The package is describe in this document: https://www.sharelatex.com/learn/TikZ_package
\usepackage{tikz}
% If the graduate dials is for analogical gauges period 50-70 years, this font is ok
% OCR is open-source package deposited in the CTAN repository: https://www.ctan.org/pkg/ocr-b
% Opentype can be used on Linux and Mac machines
% (I do not know if it's possible in Windows, but I think of it),
% you can always download it from the CTAN site at this address:
% https://www.ctan.org/tex-archive/fonts/ocr-b-outline
\usepackage{ocr}
% Defines the font size to use, the first number defines the font size,
% the second number the dimensional family from which the font is taken.
% It can be assumed that there are differences between a dimensional family 10 and a 12 dimensional font.
\begin{document}
% The link OCR package documentation is this: http://ctan.mirror.garr.it/mirrors/CTAN/macros/latex/contrib/ocr-latex/ocr.pdf
% \ocrfamily - Normal font family
% \ocrnegfamily - Family negative fonts
{\ocrfamily
        \begin{tikzpicture}
            %1° Rays
            \foreach \a in {0, 5,...,355}
                \draw[ultra thick] (\a:5.6) -- (\a:6);
            %5° Rays
            \foreach \a in {0, 10,...,359}
                \draw[ultra thick] (\a:5.4) -- (\a:6);   
            %10° Rays
            \foreach \a in {0, 30,...,359}
                \draw[ultra thick] (\a:5.2) -- (\a:6);
            %Angle labels
            \foreach \a in {30, 60, 120, 150, 210, 240, 300, 330}
                \pgfmathtruncatemacro\result{(360 - \a)/10}
                \draw (\a + 90: 4.5) node[rotate=\a] {\LARGE\result};
            % Wind rose labels
            \draw (90: 4.5) node[rotate=0] {\Huge{N}};
            \draw (360: 4.5) node[rotate=270] {\Huge{E}};
            \draw (270: 4.5) node[rotate=180] {\Huge{S}};
            \draw (180: 4.5) node[rotate=90] {\Huge{W}};
            \draw (90:1) node {\LARGE{WIND UNIT}};
            \foreach \b in {-40,-38,...,40}
                \edef\c{-90 - \b * 1.38}
                \draw[ultra thick] (\c:6.5) -- (\c:6.8);
            \foreach \b in {-40,-30,...,40}
                \edef\c{-90 - \b * 1.38}
                \draw[ultra thick] (\c:6.5) -- (\c:7);
            \foreach \b in {-40,-30,...,40}
                \edef\c{-90 - \b * 1.38}
                \pgfmathtruncatemacro\result{abs(\b)}
                \draw (\c:6.2) node[rotate=\c+90] {\footnotesize\result};
        \end{tikzpicture}
    }
\end{document}
</syntaxhighlight>
==References==
==References==
<references />
<references />
412

edits

Navigation menu