How would we typeset a “mexican hat” like the following
in TikZ?
Best Answer
Well the top of the hat looks like a statistical normal distribution. So I would plot that function. Furthermore you could use an arc for the upper part of the hat. And at last you could use a curve for the lower part of the hat. I have tried producing the hat with the following code:
\begin{tikzpicture}[scale=3]
\draw[very thick,domain=-1.5:1.5,xscale=0.5,smooth,variable=\x] plot ({\x},{(1.3*2.718281828^(-0.5*\x*\x))});
\draw[very thick] (0,-0 cm) arc (-90:70:1.5 cm and 0.4 cm);
\draw[very thick] (0,-0 cm) arc (270:110:1.5 cm and 0.4 cm);
\begin{scope}[yshift=0.4 cm]
\draw[very thick] (-10 : -1.5 cm and 0.4 cm) .. controls (-1.25,-0.8) and (1.25,-0.8) .. (-170 : -1.5 cm and 0.4 cm);
\end{scope}
\end{tikzpicture}
I agree it's not perfect, but feel free to improve. :D
Look at the manual. It’s typeset as Ti\textit{k}Z …
You may create a new command if you would like to use it more than one time. If you use xspace, it takes care of the following space.
\documentclass{article}
\usepackage{xspace}
\newcommand{\TikZ}{Ti\textit{k}Z\xspace}
\begin{document}
\TikZ with a following space and without \TikZ.
\end{document}
As said in the the comments, there are some other possible definitions:
Ti\emph{k}Z, which will have an italic k in upright context and an upright k in italic context. So the k is always emphasizes, which may satisfies the source of the name “TikZ ist kein Zeichenprogramm” (TikZ is no drawing software), where the word kein should be emphasized.
\textup{Ti\textit{k}Z} will produce the version with upright T, i and Z and italic k in all cases. This may be preferable, when the original appearance should be kept for the whole document.
Best Answer
Well the top of the hat looks like a statistical normal distribution. So I would plot that function. Furthermore you could use an arc for the upper part of the hat. And at last you could use a curve for the lower part of the hat. I have tried producing the hat with the following code:
I agree it's not perfect, but feel free to improve. :D