Math & ScienceTriple Dots too large

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Triple Dots too large

Post by Cham »

I'm having a small spacing problem with the \dddot command. Here's a minimal working example :

Code: Select all

\documentclass[12pt,letterpaper]{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{tensor}

\begin{document}
  \begin{equation*}
    \tensor{\dddot{Q}}{_{ij}} = 3 \, \tensor{x}{_i} \; \tensor{\dddot{x}}{_j} + 3 \, \tensor{\dddot{x}}{_i} \; \tensor{x}{_j} + 9 \, \tensor{\dot{x}}{_i} \; \tensor{\ddot{x}}{_j} + 9 \, \tensor{\ddot{x}}{_i} \; \tensor{\dot{x}}{_j} - 6 \, \tensor{\dot{x}}{_k} \; \tensor{\ddot{x}}{_k} \; \tensor{\delta}{_{ij}} - 2 \, \tensor{x}{_k} \; \tensor{\dddot{x}}{_k} \; \tensor{\delta}{_{ij}}.
  \end{equation*}
\end{document}

Here's a preview :
dddot.jpg
dddot.jpg (10.57 KiB) Viewed 15902 times
The problem is the tensor index, which is now too far away from its base "x" symbol, and the spacing is now too large on the left of the "x" symbol". I want them to be exactly the same as if there wasn't any \dddot command at all.

How ?

I need a kind of horizontal \smash command on the \dddot.

Of course, this alternative is really ugly and isn't a solution.

Code: Select all

\dddot{\tensor{x}{_i}}
EDIT : Oh, and I just noticed that the "x" is raised a bit from its ground! What the ... !?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Triple Dots too large

Post by Cham »

I discovered that the accents package solves the issues, but then I have huge problems with my vectors, which are defined with the following macro.

Code: Select all

\let\oldhat\hat
\renewcommand{\vec}[1]{\mathbf{#1}}
\renewcommand{\hat}[1]{\oldhat{\mathbf{#1}}}
I'm now having lots of error messages, because of the vectors above.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Triple Dots too large

Post by localghost »

The raising problem is also described on {TeX} SX and the reasons for that are mentioned in comments and answers. The recommended trick is to add \hspace{0pt} to the argument.

Indeed there is something like a "horizontal \smash" which is called \clap. But it seems better to narrow the width of the \dddot accent by inserting some negative space between the dots and so make them looking more similar to \ddot*.

For the final solution you can redefine the \dddot command and incorporate all necessary modifications.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathtools}   % loads »amsmath«

\makeatletter
\renewcommand{\dddot}[1]{%
  {\mathop{#1\hspace{0pt}}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@
   \hbox {\normalfont .\kern-.1em.\kern-.1em.}\vss}}}}
\renewcommand{\ddddot}[1]{%
  {\mathop{#1\hspace{0pt}}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@
   \hbox{\normalfont\clap{.\kern-.1em.\kern-.1em.\kern-.1em.}}\vss}}}}
\makeatother

\begin{document}
  \begin{equation*}
  \dddot{Q}_{ij} = 3 \, {x}_i \; \dddot{x}_j + 3 \, \dddot{x}_i \; x_j + 9 \, \dot{x}_i \; \ddot{x}_j + 9 \, \ddot{x}_i \; \dot{x}_j - 6 \, \dot{x}_k \; \ddot{x}_k \; \delta_{ij} - 2 \, x_k \; \dddot{x}_k \; \delta_{ij}.
  \end{equation*}
\end{document}
Remarks:
  • Use of the tensor package is superfluous here. It only makes the code messy.

Thorsten


____________
* For the \ddddot command (which generates for dots) this will not be enough so that the \clap command comes into play again.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Re: Triple Dots too large

Post by Cham »

Thanks localghost,

but then what is the "best" solution ? To use your redefinition, or to use the accents package and change my vectors macros (which should be easy) ?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Triple Dots too large

Post by localghost »

The final decision is up to you. The choice only depends on the amount of work.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Re: Triple Dots too large

Post by Cham »

I noticed a small difference with your redifinition of the \dddot command : on some slanted symbols, the horizontal position is slightly shifted, compared with the version from the accents package.

I think I'll go with the accents package and change my vectors defs.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Triple Dots too large

Post by localghost »

Cham wrote:I noticed a small difference with your redifinition of the \dddot command : on some slanted symbols, the horizontal position is slightly shifted, compared with the version from the accents package. […]
This effect is not caused by the redefinition. And it does not only affect some symbols, but all. It's in the nature of things. The redefinition is only a tweak at some places and not a complete rewrite.

Using a package can be favorable because package code is usually maintained. The presented code here probably not.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Re: Triple Dots too large

Post by Cham »

Ok, thanks for the explanations.

Apparently, the accents package is doing things right. The dots position is much nicer, on close inspection.

My issue appears to be solved. Thanks for the help.
Post Reply