The graphics
package also lets you rotate boxes, as explained in Section 7.2 of Lamport's LaTeX: A document preparation system. You use \rotatebox{x}{text}
, where x
is a specified angle in the positive (counterclockwise) direction with the "positive x-axis", which extends horizontally from the basepoint of the box that contains text
.
You could, of course, use TikZ for this:
The symbol will scale with your font size, since it uses ex
to define the path.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\newcommand\shield{%
\tikz [baseline] \draw (0,1.75ex) -- (0,0.75ex) arc [radius=0.75ex, start angle=-180, end angle=0] -- (1.5ex,1.75ex) -- cycle;%
}
A shield: \shield
\end{document}
If you're feeling fancy, you could parametrise it a bit:
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\newcommand\shield[1][]{%
\tikzset{
shield width/.store in=\shieldwidth,
shield width=1.5ex,
shield height/.store in=\shieldheight,
shield height=1.75ex
}%
\tikz [baseline,#1] \draw (0,\shieldheight) -- (0,\shieldwidth/2) arc [radius=\shieldwidth/2, start angle=-180, end angle=0] -- (\shieldwidth,\shieldheight) -- cycle;%
}
A shield: \shield
A wide shield: \shield[shield width=2ex]
A tall shield: \shield[shield height=3ex]
\end{document}
Best Answer
Here, I introduce
\pigpenXXXX
whereXXXX
is some combination of0
and1
that signify strokes on the left, top, right, bottom (i.e., clockwise starting on left). Stroke length and width are defined by\rlln
and\rlwd
, respectively. The symbols are defined to sit on the baseline.Naturally, one could define letters like
\def\ppA{\pigpen0011}
, etc.EDITED to make suitable for use in math mode, though it will also function in text mode.
UPDATE:
The OP requested a version with rounded endcaps. To do so, I use my custom style file
roundrule.sty
, found exclusively at the end of this answer:Is there such a thing as a `\mathrule`? (rounded endcaps)
I then modify my above answer to use round rules instead of rules. I probably need to update
roundrule.sty
, because I found that if one of the rule dimensions is 0pt, it still outputs a thin line. To circumvent that problem for this answer, I perform a check on the roundrule dimensions.