9

I've had endless problems trying to get bold, upright theta symbol, with a bold hat on top, and an ordinary dot on top of that.

I got most of the way, minus the dot, using the following code: (I got the unslanted theta code from here)

\documentclass{article}

\usepackage{mathtools}
\usepackage{scalerel}

\newsavebox{\foobox}
\newcommand{\slantbox}[2][0]{\mbox{%
    \sbox{\foobox}{#2}%
    \hskip\wd\foobox
    \pdfsave
    \pdfsetmatrix{1 0 #1 1}%
    \llap{\usebox{\foobox}}%
    \pdfrestore
}}
\newcommand\unslant[2][-.25]{%
    \mkern1mu%
    \ThisStyle{\slantbox[#1]{$\SavedStyle#2$}}%
    \mkern-1mu%
}
\newcommand{\utheta}{\unslant\theta}

\begin{document}
    $\boldsymbol{\mathrm{\hat{\utheta}}}$
\end{document}

This gives me an output of everything I want, except an ordinary dot on top:

enter image description here

As soon as I wrap the existing code in \dot{}, things go haywire, with error messages including lots of @ symbols, which I assume means I really messed something up. If anyone has a solution to this, it'd be much appreciated!

Things I don't want:

  • A solution involving upgreek, since non-symmetrical versions of theta like that look ugly to me.
  • The code $\boldsymbol{\mathrm{\dot{\hat{\utheta}}}}$ isn't what I'm looking for, since the dot is bold.
  • Please no pmb.
  • Solutions involving a change of font. I'm sticking with Computer Modern for this project.
  • Is that hat centred over the theta? It looks slightly right of centre to me. (Maybe that is the desired outcome.) – LSpice Feb 23 '17 at 18:43
  • It's not, but involving kerning would've made the question more complicated. – J-J Feb 23 '17 at 19:30
7

Stack a dot on top. The gap (currently .5pt) is adjustable with the optional argument to \stackon. EDITED to take Mico's advice (except with +/-1.3 mu instead of 1.5).

\documentclass{article}

\usepackage{mathtools}
\usepackage{scalerel,stackengine}
\stackMath

\newsavebox{\foobox}
\newcommand{\slantbox}[2][0]{\mbox{%
    \sbox{\foobox}{#2}%
    \hskip\wd\foobox
    \pdfsave
    \pdfsetmatrix{1 0 #1 1}%
    \llap{\usebox{\foobox}}%
    \pdfrestore
}}
\newcommand\unslant[2][-.25]{%
    \mkern1.3mu%
    \ThisStyle{\slantbox[#1]{$\SavedStyle#2$}}%
    \mkern-1.3mu%
}
\newcommand{\utheta}{\mathord{\unslant\theta}}

\begin{document}
    $\boldsymbol{\hat{\utheta}}$
and this
    $\stackon[.5pt]{\boldsymbol{\hat{\utheta}}}{.}$
\end{document}

enter image description here

  • 1
    Two suggestions: First, instead of deploying \mathrm, set \newcommand{\utheta}{\mathord{\unslant\theta}}. Second, increase the arguments of \mkern to 1.5mu and -1.5mu, respectively, to get better centering of \utheta below the stacked accents. – Mico Feb 21 '17 at 12:45
  • 1
    @Mico Done...except used 1.3mu, since I felt 1.5mu overcompensated. – Steven B. Segletes Feb 21 '17 at 12:51
  • 1
    It works like a charm :) Thanks a lot! I'll fiddle with the kerning myself till it looks decent. – J-J Feb 21 '17 at 13:04
8

I suggest you load both the upgreek (gulp...) and bm packages along with amsmath and write something along the lines of the code shown below.

enter image description here

\documentclass{article}
\usepackage{amsmath,upgreek,bm}
\begin{document}
$\dot{\bm{\hat{\uptheta}}}, 
 \dot{\hat{\uptheta}}, 
 \dot{\hat{\theta}}$
\end{document}
  • 1
    I specifically don't want upgreek's ugly thetas. – J-J Feb 21 '17 at 12:55
  • 5
    @Jean-JacqduPlessis - I did notice your aversion to the upgreek package in your initial posting. I chose to provide this answer anyway as it may be of interest to other readers of your posting. You are, of course, entirely free to disregard it. – Mico Feb 21 '17 at 12:57
4

enter image description here

\documentclass{article}

\usepackage{mathtools,bm}
\usepackage{scalerel}

\newsavebox{\foobox}
\newcommand{\slantbox}[2][0]{\mbox{%
    \sbox{\foobox}{#2}%
    \hskip\wd\foobox
    \pdfsave
    \pdfsetmatrix{1 0 #1 1}%
    \llap{\usebox{\foobox}}%
    \pdfrestore
}}
\newcommand\unslant[2][-.25]{%
    \mkern1mu%
    \ThisStyle{\slantbox[#1]{$\SavedStyle#2$}}%
    \mkern-1mu%
}
\newcommand{\utheta}{\unslant\theta}

\begin{document}


    $\dot{\boldsymbol{\hat{{\utheta}}}}$ $\boldsymbol{\dot{\hat{{\utheta}}}}$
\end{document}
  • 1
    How does your answer differ (meaningfully) from Steven's? (I realize that writing {\utheta}, i.e., encasing \utheta in curly braces) is the same as defining the symbol to be of type mathord. ) – Mico Feb 21 '17 at 13:41
  • 1
    @Mico ??? It's completely different isn't it? I place the dot using \dot{xxx} Steven uses \stackon[.5pt]{xxx}{.} not using the mathaccent primitive at all. – David Carlisle Feb 21 '17 at 13:57
  • You're right. I had mistakenly focused on the code for \unslant and \slantbox (which came, via the OP, from another answer of Steven's). – Mico Feb 21 '17 at 14:13
  • 1
    @DavidCarlislel to be fair, misunderstandings like Mico's are expected when "mic-drop" answers like this one don't supply any discussion or context beyond the code. – user1717828 Feb 21 '17 at 18:39
  • Thanks, but this solution doesn't answer the question, as the dot is bold, which causes an inconsistency with other dots. – J-J Feb 23 '17 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.