# How to specify an accent's relative position?

Building on this answer, I created symbols that looks like curly \ll and \gg with a dot on top, as follows.

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\DeclareFontFamily{U}{mathb}{\hyphenchar\font45}
\DeclareFontShape{U}{mathb}{m}{n}{
<-6> mathb5 <6-7> mathb6 <7-8> mathb7
<8-9> mathb8 <9-10> mathb9
<10-12> mathb10 <12-> mathb12
}{}
\DeclareSymbolFont{mathb}{U}{mathb}{m}{n}
\DeclareMathSymbol{\llcurly}{\mathrel}{mathb}{"CE}
\DeclareMathSymbol{\rrcurly}{\mathrel}{mathb}{"CF}
\newcommand\dotllcurly{\mathrel{\dot{\llcurly}}}
\newcommand\dotrrcurly{\mathrel{\dot{\rrcurly}}}
\begin{document}
$a\dotllcurly b, c\dotrrcurly d$
\end{document}


However, when I added these definitions to an existing document with a rather long preamble, the result was as follows (notice the dots' different relative positions).

Is there a way to change the definitions of \dotllcurly and \dotrrcurly as to fix the relative position of the dots to appear as they do in the first picture?

• @AlanMunn: Maybe there is an explicit way to specify the position of the dot relative to the underlying symbol. In the code sample listed above the positioning is done implicitly, and is therefore affected by the pre-existing definitions in the preamble. – Evan Aad Mar 31 '18 at 19:47
• Well, what about first finding out what pre-existing definitions influence the result? Did you tamper with \dot, perhaps? – egreg Apr 1 '18 at 8:51
• @egreg: If I tampered with \dot, it was not intentional. My preamble is quite long and it would take me a lot more time to try to figure out what influenced the result, than to use one of the excellent solutions provided in the answers below. – Evan Aad Apr 1 '18 at 12:03

The following example uses \cdot for the dot and positions it relative to the width of the symbol and the height of the math axis. Math style are supported.

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\DeclareFontFamily{U}{mathb}{\hyphenchar\font45}
\DeclareFontShape{U}{mathb}{m}{n}{
<-6> mathb5 <6-7> mathb6 <7-8> mathb7
<8-9> mathb8 <9-10> mathb9
<10-12> mathb10 <12-> mathb12
}{}
\DeclareSymbolFont{mathb}{U}{mathb}{m}{n}
\DeclareMathSymbol{\llcurly}{\mathrel}{mathb}{"CE}
\DeclareMathSymbol{\rrcurly}{\mathrel}{mathb}{"CF}

\makeatletter
\newcommand*{\dotllcurly}{%
\mathrel{%
\mathpalette\@dotxxcurly\llcurly
}%
}
\newcommand*{\dotrrcurly}{%
\mathrel{%
\mathpalette\@dotxxcurly\rrcurly
}%
}
\newcommand*{\@dotxxcurly@x}{.225}
\newcommand*{\@dotxxcurly@y}{1.1}
\newcommand*{\@dotxxcurly}[2]{%
% #1: math style
% #2: \llcurly or \rrcurly
\sbox0{$#1#2\m@th$}% box0 -> symbol
\sbox2{$#1\vcenter{}$}% \ht2 -> math axis
\rlap{%
\hbox to \wd0{%
\ifx#2\llcurly
\kern\@dotxxcurly@x\wd0 %
\else
\hfil
\fi
\raise\@dotxxcurly@y\ht2\hbox{$#1\cdot\m@th$}%
\ifx#2\rrcurly
\kern\@dotxxcurly@x\wd0 %
\else
\hfil
\fi
}%
}%
\box0 %
}

\makeatother

\begin{document}
$a\dotllcurly b, c\dotrrcurly d \quad \scriptstyle a\dotllcurly b, c\dotrrcurly d \quad \scriptscriptstyle a\dotllcurly b, c\dotrrcurly d$
\end{document}


Fine tuning, see macros:

• \@dotxxcurly@x: Factor is multiplied with the width of the symbol and specifies the position of the dot relative to the point/tip of the symbol.

• \@dotxxcurly@y: Factor is multiplied with the height of the math axis and specifies the raise amount of the dot.

A stackengine approach using scalerel to work across the various math styles:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\DeclareFontFamily{U}{mathb}{\hyphenchar\font45}
\DeclareFontShape{U}{mathb}{m}{n}{
<-6> mathb5 <6-7> mathb6 <7-8> mathb7
<8-9> mathb8 <9-10> mathb9
<10-12> mathb10 <12-> mathb12
}{}
\DeclareSymbolFont{mathb}{U}{mathb}{m}{n}
\DeclareMathSymbol{\llcurly}{\mathrel}{mathb}{"CE}
\DeclareMathSymbol{\rrcurly}{\mathrel}{mathb}{"CF}
\usepackage{stackengine,scalerel}
\newcommand\dotllcurly{\mathrel{\ThisStyle{\ensurestackMath{%
\stackengine{-2\LMpt}{\SavedStyle\llcurly}{\SavedStyle\cdot}{O}{c}{F}{F}{S}}}}}
\newcommand\dotrrcurly{\mathrel{\ThisStyle{\ensurestackMath{%
\stackengine{-2\LMpt}{\SavedStyle\rrcurly}{\SavedStyle\cdot}{O}{c}{F}{F}{S}}}}}
\begin{document}
$a\dotllcurly b, c\dotrrcurly d$

$\scriptstyle a\dotllcurly b, c\dotrrcurly d$

$\scriptscriptstyle a\dotllcurly b, c\dotrrcurly d$
\end{document}