Incorrect spacing and sizing, probably caused by LaTeX template

  • Context: LaTeX 
  • Thread starter Thread starter Fredrik
  • Start date Start date
  • Tags Tags
    Latex Sizing
Click For Summary

Discussion Overview

The discussion revolves around issues related to LaTeX formatting, specifically concerning spacing and sizing of mathematical symbols and fonts when using a particular LaTeX template. Participants explore potential causes and solutions for these formatting problems, including the use of various packages and document classes.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Exploratory

Main Points Raised

  • One participant describes issues with the sizing of parentheses when using \left and \right, noting they appear too large in certain contexts.
  • Another participant points out potential conflicts among several packages being used, such as mathptmx, type1cm, and amsmath, which could be affecting the math fonts.
  • A participant mentions experiencing unexpected spacing after mathbb characters, requiring adjustments to ensure punctuation appears correctly.
  • Some participants suggest testing with a simpler document class, like "article," to isolate the problem.
  • One participant notes that the appearance of mathbb characters varies, with some appearing differently than expected, particularly in terms of serif styles.
  • There is discussion about the behavior of \left and \right, with a participant expressing uncertainty about their expected sizes in different contexts.
  • Another participant finds that the issues may be related to the DVI viewer being used, as results differ when switching to PDFLaTeX.
  • One participant suggests using size selection commands like \Big... to control delimiter sizes more precisely.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the root cause of the formatting issues, with multiple competing views on the influence of different packages and document classes. The discussion remains unresolved regarding the best approach to fix the problems.

Contextual Notes

Participants note that the order of package loading may be significant and that certain packages might be redundant when using others. There is also mention of the limitations of specific viewers affecting the appearance of the output.

Fredrik
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
Messages
10,876
Reaction score
423
For about a year and a half now, I've been writing down stuff I've learned into a bunch of LateX files, to make it easy to refresh my memory when I've forgotten something, and perhaps also to be able to show some of it to other people at some point. In order to make it look nice, I chose to use a template that a publisher provides for their book authors. (If someone wants to see it, it's the "monograph" file that can be downloaded from http://www.springer.com/authors/book+authors?SGWID=0-154102-12-417900-0). Everything does look really nice, except for two things:

1. When I use \left and \right to have LaTeX choose the size of parentheses and stuff, they always turn out too big. This also happens when I use the cases environment.

2. There appears to be a negative space after each mathbb character, so if I e.g. want to end a sentence with "\mathbb C." have to type it as "\mathbb C\ .", or the period won't be visible.

These are problems that can be worked around without too much trouble, but I would of course prefer to fix the problem rather than work around it every time. So does anyone have any idea about what might be wrong? I don't even know what to look for. I guess I should look in the .cls file, but look for what?

This is the stuff at the start of the main LaTeX file.

Code:
documentclass[graybox,envcountchap,sectrefs,envcountsame]{svmono}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{courier}
\usepackage{type1cm}         
\usepackage{makeidx} 
\usepackage{graphicx}
\usepackage{multicol}
\usepackage[bottom]{footmisc}
\usepackage{mathtools}
\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
\makeindex           
\usepackage{amsmath,amssymb,enumerate,mathtools}

The DeclareMathAlphabet command is something I found in a Google search. It restores the normal mathcal font, which had been replaced by something else.
 
Physics news on Phys.org
I had a quick look at your document class and it doesn't seem to be redefining any math fonts, though it uses them in lots of places.

You have several packages that could be trying to redefine the math fonts and fighting each other, e.g. mathptmx, type1cm, mathtools, amsmath, amssymb
and the \DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n} command.

I would start by looking at your .log file, to see what math fonts you are actually using.

The ams... classes on their own should work OK.

Start with a "plain vanilla" document class like "article" plus the ams... packages and see if that looks OK. If not, then you and LaTeX fundamentally disagree about what "looks right" so you need to find a compromise on that before you add anything else into the mix.

Then try svmono class with just the asm... packages.

Then add the other packages one at a time to see what breaks it. Sometimes, the order of loading the packages is significant. Unless a package says internally that it depends on another package, they are loaded in the order they appear in the .tex file.

The graphicx multicol and footmisc packages shouldn't have any effect on math.

Re \left and \right, remember they are desgined to make delimiters bigger than everything inside them, which is sometimes too big. For example if you want
Code:
[ ... ( ... ) ... ]

you probably want the [] and () the same size as each other, but
Code:
\left[ ... \left( ... \right) ... \right]
will make the [ ] bigger than the ( ).

EDIT: If you load amsmath, load amsfonts as well (and weed out any other packages that it makes redundant, of course).
 
Last edited:
Thanks for the tips. I will try them out tomorrow morning, and report the results here some time during the day.
 
Interesting. I'm getting the same problem with the mathbb font when I just use \documentclass{article} and \usepackage{amssymb}. (Without amssymb, the \mathbb command is not understood). The mathbb font appears to be different mathbb font than the one that's used here:

\mathbb C.\mathbb N.\mathbb Q.\mathbb R.\mathbb F.

My mathbb characters have serifs, and the "tail" on the Q consists of two curves meeting at a point, not a single curve as here on PF. Edit: I tried changing amssymb to amsfonts. It didn't change anything.

I may have exaggerated the problem with the mathbb fonts somewhat. Only the C is really messed up. With the other symbols, a period after a mathbb character is a bit too close to the character, but with the C, it's actually on the C, to the left of the point where the C ends.

Regarding the left/right issue, I may have made a bigger mistake there. For example, even here at PF, the left/right parentheses surrounding a sum is big enough to cover the limits both over and under the Ʃ, even if there is no upper limit. For example: \left(\sum_{i\in I} P_i\right)x
So maybe the only problem was my expectations. I'm still not sure. Right now I can't think of a situation where \left and \right definitely give me the wrong sizes. However, I did get weird results when I wrote this:
\sum_{i\in I}P_ix=<br /> \begin{cases}<br /> x &amp;\text{if}~x\in M\\<br /> 0 &amp;\text{if}~x\in M^\perp.<br /> \end{cases}<br />
The code requires the amsmath package.
Code:
[tex]\sum_{i\in I}P_ix=
\begin{cases}
x &\text{if}~x\in M\\
0 &\text{if}~x\in M^\perp.
\end{cases}
[/tex]
The left curly bracket is a little bigger in my document, but it's not really a problem. I'll either just ignore it or use \left{ with the array environment.
 
Last edited:
So the good news is, we now know where the problem is, even if we don't know what it is.

I tried this in MikTeX 2.9:
Code:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
$$\mathbb C. \mathbb N. \mathbb Q. \mathbb R. \mathbb F.$$
\end{document}
The output looks the same as in your post #4 - no bad spacing. I've attached a copy of my logfile to compare with yours.

EDIT: I see you didn't load amsmath, but it still works for me without it.

For example, even here at PF, the left/right parentheses surrounding a sum is big enough to cover the limits both over and under the Ʃ, even if there is no upper limit.

Yeah, the TeXBook says it does that :(
Knuth doesn't seem to give a workround, except selecting the delimiter size with one of the the \Big... macros.
But your problem with \case could be part of the same fonts issue that is screwing up \mathbb of course...


I guess the only answer is select the size you want with one of the \Big... macros.
 

Attachments

Last edited:
Oh my dog, the problem is with the built-in dvi viewer. (I'm using the LaTeX editor "LEd"). When I ran LaTeX on your code, the result was ugly. So I ran PDFLaTeX instead, and the result looked fine. Then I ran LaTeX again, and converted the dvi to PDF. It still looked fine. So I opened the dvi file in Yap ("Yet another previewer"). Now the mathbb characters looked fine but other things were ugly. There was e.g. a \|x\| that looked like \|\,x\!\|. In the PDF, those things looked good too.

Thank you very much for helping me figure this out. At least now I know that I should stop typing a "\ " after every "\mathbb C". :smile:

The curly bracket produced by "cases" looks the same in the PDF as in the dvi, a little bit bigger than I'd want them to be (and a little bit bigger than at PF), but it doesn't bother me as much as the mathbb issue, so I'm not going to spend any more time thinking about that. Thanks again, you've been a great help.
 
Last edited:
Fredrik said:
Oh my dog, the problem is with the built-in dvi viewer. (I'm using the LaTeX editor "LEd"). When I ran LaTeX on your code, the result was ugly. So I ran PDFLaTeX instead, and the result looked fine. Then I ran LaTeX again, and converted the dvi to PDF. It still looked fine. So I opened the dvi file in Yap ("Yet another previewer"). Now the mathbb characters looked fine but other things were ugly. There was e.g. a \|x\| that looked like \|\,x\!\|. In the PDF, those things looked good too.

You just reminded my why I never use a LaTex "IDE", just a text editor that can run an OS command with a single keystroke, and a PDF viewer :smile:
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 4 ·
Replies
4
Views
5K