9

Is there a ruler symbol in some LaTeX package?

I would like something similar to the clock symbol in the wasysym package.

0

3 Answers 3

18

You can make one yourself. An example from the answer to this question can be tweaked as you like.

\documentclass[tikz,border=1cm]{standalone}

\begin{document}
        \begin{tikzpicture}
            \draw (-0.2,0) rectangle (15.5,1);
            %% lower divisions
            \foreach \x in {0,1,...,15}{
            \draw (\x,0) -- (\x,0.2)node[above,scale=0.4]{\x};
            }
            \foreach \x in {0.1,0.2,...,14.9}{
            \draw (\x,0) -- (\x,0.075);
            }
            \foreach \x in {0.5,1,...,14.5}{
            \draw (\x,0) -- (\x,0.15);
            }
            % Upper divisions
            \foreach \x in {0,1,...,6}{
            \draw (\x in,1) -- (\x in,0.8)node[below,scale=0.4]{\x};
            }
            \foreach \x in {0.1,0.2,...,5.9}{
            \draw (\x in,1) -- (\x in,0.925);
            }
            \foreach \x in {0.5,1,...,5.5}{
            \draw (\x in,1) -- (\x in,0.85);
            }
        \end{tikzpicture}
\end{document}

enter image description here

4
  • That is awesome! Commented Sep 30, 2015 at 19:26
  • Didn't you already provide this code as a solution here ;) ?
    – cfr
    Commented Oct 1, 2015 at 1:55
  • @cfr yikes. seems so. This should be wiki. Thanks for locating it.
    – user11232
    Commented Oct 1, 2015 at 3:50
  • Well, it is obviously good code!
    – cfr
    Commented Oct 1, 2015 at 13:02
10

Find a good ruler image on the web, such as http://etc.usf.edu/clipart/36400/36459/ruler1_36459_lg.gif. Save it to your system, and convert it to a jpeg image (I used Paint to do so). Then, just \includegraphics it into your document, using scalerel to make it the height of a capital "X". It will auto-adjust to the current font size.

[As Ethan notes in a comment, one must pay attention to the terms of use. For this particular image, use is limited to educational, but not commercial purposes]

\documentclass{article}
\usepackage{scalerel,graphicx}
\newcommand\ruler{\scalerel*{\includegraphics{ruler1_36459_lg}}{X}}
\begin{document}
Here is my ruler: \ruler

\LARGE or large: \ruler
\end{document}

enter image description here

Perhaps, if one desires something a bit more compact and lo-resolution, there is http://www.clipartbest.com/cliparts/yio/g8b/yiog8b5oT.png, which can be used directly without format conversion:

\documentclass{article}
\usepackage{scalerel,graphicx}
\newcommand\ruler{\scalerel*{\includegraphics{yiog8b5oT}}{X}}
\begin{document}
Here is my ruler: \ruler

\LARGE or large: \ruler
\end{document}

enter image description here

It is possible I misunderstood the OP's implication of "ruler". It was compared with the wasysym clock symbol. We know a broken clock is right twice a day. As to this broken ruler, maybe not so much.

\documentclass{article}
\usepackage{scalerel,stackengine,graphicx,simpsons}
\newcommand\ruler{\scalerel*{\stackon[-12pt]{\Homer}{%
  \rotatebox{12}{%
  \includegraphics[scale=.035]{Gold_Crown_with_Red_Diamonds_PNG_Clipart}%
  }\kern11pt}}{X}}
\begin{document}
Here is my ruler: \ruler

\LARGE or large: \ruler
\end{document}

enter image description here

(ref: http://gallery.yopriceville.com/Free-Clipart-Pictures/Crowns-PNG/Gold_Crown_with_Red_Diamonds_PNG_Clipart#.VgvUS24rjao)

1
  • 2
    Nice. But do note the terms of service at etc.usf.edu/clipart - this is free for educational purposes but not commercial. Commented Sep 30, 2015 at 13:34
5

In case you have no TikZ packages installed on your machine. I just draw the centimeter part as any other units (inch, etc) can be drawn with almost the same way.

\documentclass[pstricks,margin=1mm]{standalone}

\begin{document}
\begin{pspicture}(-.2,1.5)(10.2,3)
    \psframe[linecolor=lightgray](-.2,1.5)(10.2,3)
    \multips(0,3)(0.1,0){101}{\psline(0,-.1)}
    \multips(0,3)(0.5,0){21}{\psline(0,-.2)}
    \foreach \x in {0,...,10}{\rput(\x,3){\psline(0,-.3)}\uput{4mm}[-90](\x,3){\scriptsize$\x$}}
    \rput[r](10,1.8){\scriptsize Made in Japan}
\end{pspicture}
\end{document}

enter image description here

Not the answer you're looking for? Browse other questions tagged .