[OS X TeX] Angular Vernier scale

Michael Sharpe msharpe at ucsd.edu
Sun Jun 2 00:38:36 EDT 2013


On Jun 1, 2013, at 6:42 PM, Aaron Jackson <jackson at msrce.howard.edu> wrote:

> On Jun 1, 2013, at 4:15 PM, Michael Sharpe <msharpe at ucsd.edu> wrote:
> 
>> 
>> On Jun 1, 2013, at 12:21 PM, Aaron Jackson <jackson at msrce.howard.edu> wrote:
>> 
>>> I have to make some documentation for a piece of scientific equipment. This will entail making quite a few illustrations of different settings on an angular vernier scale, similar to the one show here
>>> 
>>> http://www.craftsmanspace.com/sites/default/files/free-knowledge-articles/bevel_protractor_vernier_scale.jpg
>>> 
>>> Does anybody know an easy way to draw this sort of scale?
>>> 
>>> Thanks,
>>> 
>> 
>> The LaTeX packages pstricks and tikz/pgf would be suitable, as would a number of others. There is code on which you could base your drawing at 
>> 
>> http://tug.org/PSTricks/main.cgi?file=examples#compass
>> 
>> or
>> 
>> http://www.texample.net/tikz/examples/degree-wheel/
>> 
>> Michael
> 
> Thanks for the pointer. For completeness, this is what I came up with. It is a modified version of the tikz example:
> 
> % A simple compass
> % Author: Dario Orescanin
> 
> \documentclass{minimal}
> \usepackage{tikz}
> \begin{document}
> 
> \begin{centering}
> 
> % Define a few constants for easy configuration
> \def\radius{2cm}
> \def\onedegrad{1.8cm}
> \def\fivedegrad{1.75cm}
> \def\tendegrad{1.7cm}
> \def\labelrad{1.6cm}
> 
> \def\minradius{2.3cm}
> \def\fifteenmin{2.2cm}
> \def\fivemin{2.1cm}
> \def\minlabel{2.25cm}
> \def\vernierunit{1.9}
> \def\verniercount{10}
> \def\rotation{31.6}
> 
> \begin{tikzpicture}[scale=4]
> 
>  % adding a subtle gray tone to add a bit of "personality"
>  \shade[shading=radial, inner color=white, outer color=gray!15] (0,0) circle (\radius);
> 
>  \draw (0,0) circle (\radius);
>  \draw[fill=black] (0,0) circle (.02mm);
>  \node[draw, circle, inner sep=.2mm] (a) at (0,0) {};
> 
>  % helper lines
>  \foreach \x in {0, 45, ..., 360} \draw[very thin, gray!40] (a) -- (\x+\rotation:\radius);
> 
>  % main lines
>  \foreach \x in {0,...,359} \draw (\x+\rotation:\onedegrad) -- (\x+\rotation:\radius);
> 
>  % labels and longer lines at every 10 degrees
>  \foreach \x in {0,10,...,350}
>  {
>    \node[scale=1.4] at (270-\x+\rotation:\labelrad) {\x};
>    \draw (\x+\rotation:\tendegrad) -- (\x+\rotation:\radius);
>  };
> 
>  % lines at every 5 degrees
>  \foreach \x in {0,5,...,355}  \draw (\x+\rotation:\fivedegrad) -- (\x+\rotation:\radius);
>   \draw (0,0) circle (\minradius);
>   \foreach \x in {0,...,20} \draw  (270-\vernierunit*\verniercount+\x*\vernierunit:\radius) -- (270-\vernierunit*\verniercount+\x*\vernierunit:\fivemin);
>   \foreach \x in {0,5,...,20} \draw  (270-\vernierunit*\verniercount+\x*\vernierunit:\radius) -- (270-\vernierunit*\verniercount+\x*\vernierunit:\fifteenmin);
>   \node at (270:\minlabel) {0'};
>   \node at (270-\vernierunit*\verniercount:\minlabel) {60'};
>   \node at (270+\vernierunit*\verniercount:\minlabel) {60'};
>   \node at (270-\vernierunit*\verniercount+5*\vernierunit:\minlabel) {30'};
>   \node at (270-\vernierunit*\verniercount+15*\vernierunit:\minlabel) {30'};
> \end{tikzpicture}
> \end{centering}
> \end{document}
> 
My brief attempt using pstricks, with which I am more familiar:

% !TEX TS-program = latex
\documentclass{article}
\usepackage{pstricks-add}
\pagestyle{empty}
\parindent=0pt
\def\ctr{(0,0)}
\def\orad{7}
\def\irad{6}
\def\irada{5.6}
\def\iradb{5.8}
\def\xx{3} % -3 to 3
\def\ymin{5}
\def\ymax{7.5}
\def\angoffset{24.5}
\def\lw{1.2pt}
\begin{document}
% 
\psset{unit=1in}
\def\extscale{\multido{\iA=0+1}{360}{\psrline[linewidth=\lw](\irad;\iA)(.4;\iA)}
\multido{\iA=0+5,\iB=-90+10}{72}{\psrline[linewidth=\lw](\irad;\iA)(.5;\iA)}\multido{\iA=0+10,\iB=-90+10,\iC=90+-10}{36}{\psrline[linewidth=\lw](\irad;\iA)(.6;\iA)\rput{\iB}(6.75;\iA){\iC}}}%
\begin{pspicture*}(-\xx,\ymin)(\xx,\ymax)%
\pscircle{\orad}%
\pscircle{\irad}%
\rput{\angoffset}(0,0){\extscale}%
\multido{\rA=67+1.91667}{25}{\psrline[linewidth=\lw](\iradb;\rA)(.2;\rA)}%  
\multido{\rA=67+5.75,\rB=-23+5.75,\iA=60+-15}{9}{\psrline[linewidth=\lw](\irada;\rA)(.4;\rA)%
\rput{\rB}(5.5;\rA){\iA}}%  
\end{pspicture*}

\vspace{1pc}
Angular Vernier scale
\end{document}




More information about the MacOSX-TeX mailing list