6

I would like to achieve the following: a dot right of an expression

with this minimal example

\documentclass{article}
\usepackage{amsmath}
\usepackage{accents}

\newcommand{\dotr}[1]{%
#1\accentset{\mbox{\bfseries .}}{\vphantom{#1}}}

\begin{document}
$\dotr{(X+Y)}$
\end{document}

but the dot is too high. How can I lower the dot?

Thanks a lot!

6

A simple solution using \bullet as superscript:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\dotr}[1]{#1^{\bullet}} 

\begin{document}
$\dotr{(X+Y)}$  
\end{document}  

Result

If the bullet is too large, it can be reduced using the graphicx package. The following example also measures the first term and puts the bullet as high as possible without exceeding the height of the term before:

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\makeatletter
\newcommand{\dotr}[1]{%
  \mathpalette\@dotr{#1}%
}
\newcommand*{\@dotr}[2]{%
  % #1: math style (\displaystyle, ..., \scriptscriptstyle)
  % #2: argument of \dotr
  \sbox0{$\m@th#1#2$}%
  \usebox{0}%
  % simulating a superscript
  \raisebox{\dimexpr\ht0-\height}{$\m@th#1\@smallbullet#1\bullet$}%
  \kern\scriptspace
}
\newcommand*{\@smallbullet}[2]{%
  \scalebox{.5}{$\m@th#1#2$}%
}
\makeatother

\begin{document}
$\dotr{(X+Y)}$
\end{document}

Result

Remarks:

  • The size of the small bullet can be configured by the number for \scalebox.
  • \mathpalette takes into account the current math style. It is further explained in the answers of question "The mysteries of \mathpalette". Therefore \@dotr has two arguments, the first argument is the math style.
  • \m@th is just a shortcut (defined in the LaTeX kernel) for \mathsurround=0pt for the case someone the feature of having additional white space around math formulas.
  • \sbox is the LaTeX version of setting a box register (first argument) with a horizontal box, whose contents is given in the second argument. It should be explained in a LaTeX manual. Even box numbers below 10 are free scratch registers for local assignments. The group is indirectly given by \mathpalette.
  • Couldy you explain what exactly \sbox0{$\m@th#1#2$} does and from where the definition of \ht0 comes? Why has \@dotr 2 arguments? Thx alot! – Gabriel May 21 '13 at 8:29
  • @Gabriel I have extended the "Remarks". – Heiko Oberdiek May 21 '13 at 11:53
5

another approach:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\dotr}{\mbox{$\boldsymbol{\cdot}$}}

\begin{document}
$(X+Y)^{\dotr}$
\end{document}

output of example code

3

Your title says "Left" but your example code has a standard right superscript?

Assuming you want it on the right, I'd probably just do

(X+Y)^{\cdot}
  • good idea, but the dot is kind of puny. see my answer. – barbara beeton May 17 '13 at 13:38
  • true but \bullet is a bit big and \scriptscriptstyle\bullet too much to type. Oh I see you used a bold one, OK. – David Carlisle May 17 '13 at 14:17
1

The altitude of the dot is adjustable, currently 1ex

\documentclass{article}
\usepackage{verbatimbox}    
\newcommand{\dotr}[1]{#1\mbox{\bfseries\addvbuffer[-1ex 1ex]{.}}}
\begin{document}
$\dotr{(X+Y)}$
\end{document}

enter image description here

0

Please compare:

\documentclass{article}
\usepackage{amsmath}
\usepackage{accents}

\newcommand{\dotr}[1]{%
#1\accentset{\mbox{\bfseries .}}{\vphantom{#1}}}

\begin{document}
$\dotr{(X+Y)}$ 

$(X+Y)^{\textstyle\textbf{.}}$
\end{document}

Of course, corrections of the heighth are possible.

enter image description here

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.