2

I want to indicate |D| as a subscript of a subscript, but its spacing changes on the subscript where it becomes more distant.

\documentclass[10pt,journal,compsoc]{IEEEtran}
\begin{document}
    \phantom{} \\
    $d_{\left|D\right|}$ \\
    \(C_{H_{d_{\left|D\right|}}}^{j}\)
\end{document}

output: enter image description here

Here I observe that on the subscript of a subscript on the second line, more space is added in between | and D. Is it possible to use same spacing used on the first example on the subscript?

alper
  • 1,389
  • Note that your example has compilation errors. There is a missing } – daleif Sep 19 '22 at 14:53
  • Just curious: Why do you employ \left and \right in these formulas? – Mico Sep 19 '22 at 15:34
  • @Mico there is no specific reason :-) I have tried all examples in this answer: https://tex.stackexchange.com/a/43048/127048 , looked like \left/\right was recommended – alper Sep 19 '22 at 16:04
  • @daleif thanks fixed it – alper Sep 19 '22 at 16:05
  • 2
    don't use left right when not needed: it almost always adds unwanted horizontal space – David Carlisle Sep 19 '22 at 16:16
  • 1
    @alper - The only reasoh why using \left and \right was acceptable -- note that using \left and \right wasn't really recomended -- is because, for once, the extra whitespace that \left and \right insert just happened to be desirable for the use case at hand. I'd say that this is a classic exception that proves the rule... – Mico Sep 19 '22 at 16:51

1 Answers1

4

The Computer Modern fonts at small size (5pt, in this setting) have wider sidebearings around characters, when compared to 7pt or 10pt:

$DDD$

$\scriptstyle DDD$

$\scriptscriptstyle DDD$

produces

enter image description here

On the other hand, mixing Computer Modern math with Times in text is not the best typographic strategy.

\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage{newtxtext,newtxmath}
\usepackage{amsmath}

\begin{document}

$DDD$

$\scriptstyle DDD$

$\scriptscriptstyle DDD$

$d_{|D|}$

(C_{H_{d_{\lvert D\rvert}}}^{j})

\end{document}

enter image description here

Note that \left and \right do no good to your formulas.

egreg
  • 1,121,712
  • Why did you use newtxtext,newtxmath? – alper Sep 25 '22 at 08:24
  • @alper IEEEtran uses Times for text; this way we have Times also fir math – egreg Sep 25 '22 at 09:10
  • Thanks , in the journal template I am using has IEEEtran as well, than should I use newtxtext,newtxmath too? which makes all the symbols I am using bolder – alper Sep 25 '22 at 10:42
  • @alper I’d do it: Computer Modern math is visually clashing with Times in text. – egreg Sep 25 '22 at 11:34
  • Thanks I will definetly use \usepackage{newtxmath} its much easier to read with it; but I am not sure for \usepackage{newtxtext} since it affects fonts in listing and section titles – alper Sep 25 '22 at 13:40