Incorrect spacing and sizing, probably caused by LaTeX template

In summary: M\\0&\text{if}~x\in M^\perp.\end{cases}In this code snippet, the left/right parentheses are too small.
  • #1
Fredrik
Staff Emeritus
Science Advisor
Gold Member
10,877
422
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 "[itex]\mathbb C.[/itex]" 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
  • #2
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:
  • #3
Thanks for the tips. I will try them out tomorrow morning, and report the results here some time during the day.
 
  • #4
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:

[itex]\mathbb C.\mathbb N.\mathbb Q.\mathbb R.\mathbb F.[/itex]

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: [tex]\left(\sum_{i\in I} P_i\right)x[/tex]
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:
[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 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:
  • #5
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

  • test.log.txt
    5.6 KB · Views: 535
  • test.pdf
    20.3 KB · Views: 234
Last edited:
  • #6
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 [itex]\|x\|[/itex] that looked like [itex]\|\,x\!\|[/itex]. 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:
  • #7
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 [itex]\|x\|[/itex] that looked like [itex]\|\,x\!\|[/itex]. 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:
 

1. What is LaTeX and how does it affect spacing and sizing?

LaTeX is a typesetting software commonly used in scientific writing. It automatically formats text, equations, and figures according to a predefined template. In some cases, this template may cause issues with spacing and sizing, resulting in incorrect formatting.

2. How can I fix incorrect spacing and sizing in my document?

If you are using a LaTeX template, you can try adjusting the template settings or using different commands for spacing and sizing. If you are not using a template, you can manually adjust the spacing and sizing by adjusting the font size, line spacing, and margins.

3. Why is it important to have correct spacing and sizing in a scientific document?

Correct spacing and sizing in a scientific document help improve readability and ensure that the information is presented accurately. It also helps maintain a professional and polished appearance.

4. Are there any common mistakes that can lead to incorrect spacing and sizing?

Yes, common mistakes include using incorrect commands for spacing and sizing, not adjusting the template settings properly, and not proofreading the document for formatting issues before submission.

5. Are there any tools or resources available to help with correcting spacing and sizing issues in LaTeX?

Yes, there are various online resources and forums where you can seek help from experienced LaTeX users. Additionally, many LaTeX editors have built-in features to help with formatting, and there are also external tools available to check for and fix spacing and sizing errors.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
Back
Top