412
edits
No edit summary |
|||
| Line 187: | Line 187: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Circular graduate dials | ==Circular graduate dials as editing the previous one== | ||
[[File:Graduate Dials for PHI Wind.jpg|thumbnail|Finish work example of est Graduate dials for PHI Wind|right|400px]] | [[File:Graduate Dials for PHI Wind.jpg|thumbnail|Finish work example of est Graduate dials for PHI Wind|right|400px]] | ||
If you look at this code it is virtually identical to the previous one, the lines that defined the graduated secondary dial have been eliminated. The implementation time of this new version was therefore a few minutes since we were based on the previous element. | If you look at this code it is virtually identical to the previous one, the lines that defined the graduated secondary dial have been eliminated. The implementation time of this new version was therefore a few minutes since we were based on the previous element.<BR>It is interesting to make some changes in the code to implement some parameter assignments in order to be able to easily modify this type of graduate dials. I also wanted to insert a colored arc, which is not present in the original instrument, but its construction technique is useful for other gauges that have colored arc. | ||
===Creating parametric values=== | |||
The command to use is similar to macro definition commands for other programming languages or application software: | |||
<syntaxhighlight lang="latex"> | |||
\newcommand\posWindRose{2.8} | |||
\newcommand\externalDiameter{3.55} | |||
\newcommand\graduateThick{0.3} | |||
\newcommand\arcRadius{\externalDiameter-\graduateThick/2} | |||
</syntaxhighlight> | |||
\ newcommand defines a macro type command, followed by the name of the macro that begins with the character "\". For many who are accustomed to XML, the compactness of the LaTeX code can give nausea, but it is a typical feature of the languages of the 70's and 80's when they were to be run on machines with little memory. But this essential feature of programming language is certainly a great tool to quickly build a document, thus increasing the author's productivity.<BR>Braces are the command that can be a value or an expression. Expressions can include other macro commands, as can be seen in the fourth row. Mathematical expressions in LaTeX can be very complex and include all the functions of a good scientific language. In the example I used only algebraic operations, but there are also transcendental, trigonometric, logarithmic functions etc. This allows inserting in place of the values, the expressions that generate them. | |||
===Insert a colored arc=== | |||
<syntaxhighlight lang="latex"> | |||
\begin{tikzpicture} | |||
... | |||
\draw[draw=cyan, line width=\graduateThick cm] (130:\arcRadius) arc (130:130+60:\arcRadius); | |||
... | |||
\end{tikzpicture} | |||
</syntaxhighlight> | |||
The command is fairly clear and the parameters to be varied also, the thickness is defined by a value inserted in the ''\graduateThick'' (within the square brackets) variable, which is also the thickness of the outer diameter ring. Obviously it can be redefined with a numeric value. It is important to note the presence of the measurement "cm" unit so that for the thickness of the ring do not use a different measurement units <ref>Units permitted by LaTeX: https://tex.stackexchange.com/questions/8260/what-are-the-various-units-ex-em-in-pt-bp-dd-pc-expressed-in-mm</ref>, as for example the typographical point ( pt = 1/72 inches).<BR>[[File:LaTeX Coordinates System.jpg|thumb|LaTeX Coordinates System<ref>Graphics with TikZ (''Andrew Mertz and William Slough'') Pag. 12 : https://www.tug.org/pracjourn/2007-1/mertz/mertz.pdf</ref>]]The definition of the arc requires some attention as the center of rotation needs to be defined, if it were placed (0,0) the center would coincide with the center of the Cartesian axes (Latex uses Cartesian notation, that is, the angles are anti-clockwise and the angle zero corresponds to the horizontal axis of the X)<ref>Example of coordinates in the LaTeX: https://tex.stackexchange.com/questions/155181/coordinate-system-in-latex-with-tikz</ref>. | |||
===The complete code=== | |||
<syntaxhighlight lang="latex"> | <syntaxhighlight lang="latex"> | ||
% \documentclass{standalone} is particular class that non have a size, but the size is define from | % \documentclass{standalone} is particular class that non have a size, but the size is define from | ||
edits