Fonts & Character SetsFormatting problem occurs when adding new sansserif package

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
Davidsv
Posts: 5
Joined: Wed Sep 15, 2010 5:12 pm

Formatting problem occurs when adding new sansserif package

Post by Davidsv »

I recently added the tgheros package to my document because I wanted a special look on my sans-serif text (which I only use on one page in the entire document). Everything worked well, except I noticed my chapter titles looking sort of compressed. They are not a sans-serif font, so how did this happen? More importantly, what can I do to prevent it?

In this image the top portion is how it looked before I added the tgheros package. The bottom is how it looks after. Notice the titles look compressed in comparison. The only difference is the addition of the package, I have not added any other commands between these images.
ltgpp.png
ltgpp.png (9.23 KiB) Viewed 3056 times
Here's everything before begin document:

Code: Select all

\documentclass[a4paper, 12pt, twoside]{Thesis}  % Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn
\graphicspath{{Figures/}}  % Location of the graphics files (set up for graphics to be in PDF format)

\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage{tgheros} % This is the PROBLEM maker

\usepackage[square, numbers, comma, sort&compress]{natbib}  % Use the "Natbib" style for the references in the Bibliography
\usepackage{verbatim}  % Needed for the "comment" environment to make LaTeX comments

\usepackage{setspace}
\onehalfspacing       %% 1,5-spacing

\hypersetup{urlcolor=blue, colorlinks=true}  % Colours hyperlinks in blue, but this can be distracting if there are many links.

\usepackage{todonotes}

\usepackage{graphicx,float}

\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{3}

Edit by localghost: Preferably no external links (see Board Rules). Attachments go onto the forum server where possible.
Last edited by Davidsv on Fri Oct 08, 2010 11:02 pm, edited 1 time in total.

Recommended reading 2024:

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

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

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Formatting problem occurs when adding new sansserif package

Post by frabjous »

Please see the Post on Avoidable Mistakes, and in particular, the description of what a minimal working example should look like. You shouldn't be using a document class (Thesis.cls) not available on CTAN without providing a link to it. You should provide a complete example, and not just a preamble, and you shouldn't include packages in your code that don't have anything to do with the problem.

Nevertheless, by making some changes to your sample code, I was able to replicate your result. It looks to me like a bug in the tgheros package which should be reported to the maintainer. In particular, it seems to be due to the line (in tgheros.sty):

Code: Select all

\renewcommand\bfdefault{b}
... which seems to be affected how bold text is handled even when not dealing with sans serif.

However, I can think of at least two things you can do to get around this in the meantime. The first would be to load the helvet package instead. (The TeX Gyre Heros font provided by tgheros is nearly identical to Helvetica/Nimbus Sans L; in fact, it's just an extension of it.)

So

Code: Select all

\usepackage[scaled]{helvet}
is probably a suitable replacement, unless you have some very specific special needs.

The other possibility would be to bypass the style file and just set the sans font to TeX Gyre Heros directly:

Code: Select all

\renewcommand*{\sfdefault}{qhv}
Davidsv
Posts: 5
Joined: Wed Sep 15, 2010 5:12 pm

Re: Formatting problem occurs when adding new sansserif pack

Post by Davidsv »

Thank you. I am sorry for not providing a minimal working example - it will be done next time. As for the packages that does not have anything to do with the problem: I could not be sure if there was a conflict (I guess that would have been solved anyway when creating a MWE though).

Thanks again for finding a workaround despite all that. I will probably simply use the helvet package instead for now. :)
Post Reply