Howto:Build graduate dials with LaTeX: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 2: Line 2:
Manual realization with Inkscape of a graduated dials requires a not easy re-adaptation work. This fact makes difficult to reuse a previous job to adapt it to a new one.
Manual realization with Inkscape of a graduated dials requires a not easy re-adaptation work. This fact makes difficult to reuse a previous job to adapt it to a new one.


As you will see in this article, I will try to make it possible for those who have never used LaTeX to take advantage of it to achieve great graduated circles as well as graphic objects to be placed inside a canvas.
As you will see in this article, I will try to make it possible for those who have never used LaTeX<ref>I think it's useful to read this Wikipedia article before starting to work with this technique to get a general idea of the program: https://en.wikipedia.org/wiki/LaTeX</ref> to take advantage of it to achieve great graduated circles as well as graphic objects to be placed inside a canvas.


However, I recall that the PDF or PNG file produced by LaTeX is just a first step in the job, it will definitely be necessary to work with GIMP at least to adapt the image produced to the correct size required by FGFS. But this process is also necessary if you work with Inkscape, as many of you well know.
However, I recall that the PDF or PNG file produced by LaTeX is just a first step in the job, it will definitely be necessary to work with GIMP at least to adapt the image produced to the correct size required by FGFS. But this process is also necessary if you work with Inkscape, as many of you well know.


==linear graduate dials==
==Linear graduate dials example==


[[File:Compass Kollsman 1979U4 Graduate Dials.jpg|thumbnail|Finish work example of Compass Kollsman 1979U4 Graduate Dials|right|600px|]]
[[File:Compass Kollsman 1979U4 Graduate Dials.jpg|thumbnail|Finish work example of Compass Kollsman 1979U4 Graduate Dials|right|600px|]]
I want to make a Kollsman 1979U4 compass, the graduate dials is placed on a cone trunk, very low with a fairly moderate sloping wall. In this case, even if you are having perspective errors, you can 'bundle' the cone trunk with an image that will be 1024x64 pixels.<BR>This is a fairly generic case, so the technique adopted can be extended to all similar tools. The important thing is to organize well the LaTeX program so that it is clear what we can change without changing the result.
I want to make a Kollsman 1979U4 compass, the graduate dials is placed on a cone trunk, very low with a fairly moderate sloping wall. In this case, even if you are having perspective errors, you can 'bundle' the cone trunk with an image that will be 1024x64 pixels.<BR>This is a fairly generic case, so the technique adopted can be extended to all similar tools. The important thing is to organize well the LaTeX program so that it is clear what we can change without changing the result.
Note: LaTex is a programming language, such as NASAL, XML, etc ... LaTeX is not structured as XML since, at the time of implementation (1975), XML was not yet conceived and in any case the  XML it would be too long-winded language to be used directly as an editor / formatter of a text. At this link there is a simple guide for those who want to learn LaTeX: [https://www.sharelatex.com/learn/Learn_LaTeX_in_30_minutes Learn LaTeX in 30 minutes (From Sharelatex)]
<ref>LaTex is a programming language, such as NASAL, XML, etc ... LaTeX is not structured as XML since, at the time of implementation (1975), XML was not yet conceived and in any case the  XML it would be too long-winded language to be used directly as an editor / formatter of a text. At this link there is a simple guide for those who want to learn LaTeX: [https://www.sharelatex.com/learn/Learn_LaTeX_in_30_minutes Learn LaTeX in 30 minutes (From Sharelatex)]</ref>
 
For the first example, we start from a graduated linear dial, it is a simple, fairly simple example to be realized with vector graphics programs, but when automated, as in this example, it makes it easy to reconfigure any type of gauge that has a size dominant over the others.<BR>This example is made for the graduate dial of a Kollsman 1979U4 model compass installed on the top of the FIAT G91R1B aircraft panel.
 
<syntaxhighlight lang="latex">
% \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.
\tikzset{font={\fontsize{18pt}{10}\selectfont}}
\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
    % Xscale defines the scale of the drawing with respect to the document we write.
    % It is imperative to make it compatible for the size of the graduated dial that we are designing.
    % Its determination requires a number of tests to optimize the font dimension with the units of measurement.
    \begin{tikzpicture}[xscale=0.05]
      %5° Rays
      \foreach \a in {0, 5,...,355}
\draw[line width=0.5mm] (\a,0) -- (\a,1.5mm);
      %10° Rays
      \foreach \a in {0, 10,...,350}
\draw[line width=0.5mm] (\a,0) -- (\a,2.0mm);
      %30° Rays
      \foreach \a in {0, 30,...,345}
\draw[line width=1mm] (\a,0) -- (\a,2.0mm);
      %labels 
      \draw (30,0.7) node {33};
      \draw (60,0.7) node {30};
      \draw (120,0.7) node {24};
      \draw (150,0.7) node {21};
      \draw (210,0.7) node {15};
      \draw (240,0.7) node {12};
      \draw (300,0.7) node {6};
      \draw (330,0.7) node {3};
      \draw (0,0.7) node {N};
      \draw (90,0.7) node {E};
      \draw (180,0.7) node {S};
      \draw (270,0.7) node {W};
    \end{tikzpicture}
}
\end{document}
</syntaxhighlight>
 
I think the code is pretty well commented, but there are a few comments:
<syntaxhighlight lang="latex">
\usepackage{tikz}
</syntaxhighlight>
The power of LaTeX is in the ability to customize your work using an "exaggerated" amount of modules (packages). What we use in this example is the {tikz}<ref>The graphic engine '''TikZ''' is explained in many articles, one of the most synthetics I have found is this: https://it.sharelatex.com/learn/TikZ_package</ref> graphic package, a program to integrate LaTeX graphics, graphs, diagrams and more, with a very clear syntax.
<syntaxhighlight lang="latex">
\usepackage{ocr}
</syntaxhighlight>
The G91 is a plane that belongs to a precise historical era (project in the late 50's), so the instruments used reflect that era and the fonts used reflect the techniques needed to break the numbers on the metal support typical of the analog instruments. In this case, I noticed that the OCR-B font (born in 1969) reproduces very well 95% of the characters, only the number one was in reality 'I', but in this case I did not like to customize the character, what it did for the type of license it has, but which made my example more complicated to propose. However in CTAN<ref>https://ctan.org/</ref> it is possible to propose characters closest to the aeronautical world and therefore make them available to all users.
However, modifying the font and re-compiling the LaTeX code is trivial and this is one of the advantages of this technique.
<syntaxhighlight lang="latex">
\tikzset{font={\fontsize{18pt}{10}\selectfont}}
</syntaxhighlight>
Font size is an essential element and in LaTeX it is handled very much. The main concept to know is that the font used in LaTeX can vary a lot depending on its basic size. For example, a font 6 may differ from font 10 as the readability of a font changes. This fact makes a font package, such as the ORC-B, actually made up of various subpackages made according to size, but also bold, italic, etc ..
==References==
<references />
412

edits

Navigation menu