17

I'm trying to find a good way to have the LaTex default font "Computer Modern" (CM) a bit thicker (also called "blacker"). I really like this font, especially when it comes to math mode, so answers like "Change the font." don't qualify, sorry. :) The only problem is that CM has very thin lines, so the font looks very light. There are several methods to make CM "thicker" (I'm not talking about the bold series of the font! This one looks different and is not what I am looking for.) which can be found elsewhere on tex.stackexchange:

1) Use FakeBold in XeLaTex: How to make the math font slightly thicker?

2) Use pdfliteral as suggested here: Fake bold in LuaLaTeX

3) Use pdfrender as suggested here: Make entire document heavier using pdfrender

However, the answers given there don't suit here: 1) Needs XeLaTex (I only have PDFLaTex and I cannot install additional software, as I'm not a system administrator.) Results produced with 2) + 3) look very good. Actually it looks exactly like I intend it to be. However, it only looks good with certain Reader software (Evince and certail versions of Okular). With other Reader software (like other versions of Okular or even the Adobe Reader) the base line of characters is not quite the same or there are white artefacts inside the letters.

I think, the only option to resolve the problems is to create a proper font. (The solutions in 2) and 3) don't create a new font, they are hacks that manipulate the way the original CM font is displayed.) And here is my question: How do I create a "vectorbased" (not pixelbased) proper font from Computer Modern which has the same "thickness" attributes like the results obtained with pdfrender/pdfliteral in 2) and 3) ? I don't really know anything about fonts. The basic idea should be to take the original CM font and to do some adjustments to its geometry. There is a German post:

http://www.typografie.info/3/topic/22238-ist-die-computer-modern-wirklich-zu-d%C3%BCnn/

There they talk about a "blacker" parameter in a "metafont source file" of CM. However they produce a pixel-based font and I'm not exactly sure what they are actually doing there.

Upshot: I'd like to have a thick (not bold) CM-like font which looks good with any reader software and it should be usable with PDFLaTex. Thanks for your help.


To give you an impression what I have in mind: Here's a (famous) article whose "oldschool" look I try to resemble with a modified CM font:

http://math.stanford.edu/~lekheng/flt/wiles.pdf

I've magnified it and compared it with my own "pdfliteral" results and my conclusion is that it is indeed a thicker CM (probably due to the fact that it was printed and scanned afterwards as is indicated by the not quite horizontal text lines on some pages).

I now get an idea of how to clearify my question: Using METAFONT, how do I create a new font from the original CM metafont source files (http://www.ctan.org/pkg/cm-mf) but with a higher blackness parameter?

  • 2
    Welcome to TeX.SX! If you like CM, then leave it as is. ;-) – egreg Jan 26 '15 at 17:06
  • in your last sentence, you say "doable with pdflatex". to me that simplies that the fonts could be made with pdflatex, so i think you really mean "usable". – barbara beeton Jan 26 '15 at 18:18
  • @ barbara: Yes, I should have said "usable". – user50982 Jan 27 '15 at 7:41
  • Provided that TeX produces PDFs to be read on paper as well as on the screen, the question seems to be: why is today the default font so unconfortable? – Ludenticus Jan 27 '15 at 13:49
  • You say one of the other links doesn't help as it (only) produces a pixel-based font, but then you say that you want to do this with metafont. But metafont will not give you a scalable font. There are ways of tracing metafont fonts and producing scalable fonts, but that would be a further transformation process and would not give good results without fine-tuning. – cfr Apr 1 '15 at 23:06
19

Some options include these (see examples below):

  1. Use "Latin Modern" (\usepackage{lmodern}), the updated version of Computer Modern. It looks a bit less spindly on screen and print than the original, in my opinion. (Example below)

  2. Scale "Computer Modern" as demonstrated below (thanks to this answer)

  3. Use the font "Computer Concrete" (\usepackage{concmath}), which Knuth designed as a thicker version of Computer Modern using METAFONT.

  4. Use a similar but thicker font. For example gfsbodoni (\usepackage[default]{gfsbodoni}) is in the same family of "modern" typefaces but perhaps has a more desirable weight.

  5. Use METAFONT directly and adjust it to your liking. This kind of thing was the original purpose of that program.


(EDIT)

Demonstration of font scaling (#2 above):

Here is a way that you can scale the font. You ask for a smaller font size to be magnified to a larger one; since the smaller sizes have thicker strokes, you get a thicker-looking, but also wider font. You can experiment with the proportions. This example scales cmr7 up to the default 10pt.

(I didn't get the italic working yet, and I don't think the bold is scaled, but hopefully someone else can add to this.)

\documentclass{article}

\usepackage[T1]{fontenc}

\DeclareFontShape{T1}{cmr}{mx}{n}%
    {<->cmr7}{}
\DeclareFontShape{T1}{cmr}{mx}{it}%
    {<->cmr7}{}

\AtBeginDocument{%
    \fontseries{mx}\selectfont%
}

% to create dummy text for testing
\newcommand{\quickfox}{The quick brown fox jumps over the lazy dog}
\newcommand{\Fox}{The Quick Brown Fox}
\newcommand{\Dog}{The Lazy Dog}
\newcommand{\Jumps}{Jumps Over}
\usepackage{lipsum}

\begin{document}

\section{\Fox}
\quickfox?

\subsection{\Dog}
\emph{\quickfox.}

\paragraph{\Jumps}
\lipsum[1]

\end{document}

Thus, cmr7 scaled to 10pt:

enter image description here


For comparison, here is the example with lmodern and no scaling:

enter image description here


This is gfsbodoni:

enter image description here


And this is concmath (Computer Concrete) (as noted in the comments it really is in a different font family despite being derived from Computer Modern):

enter image description here



(EDIT)

Here is a very basic demonstration of how to get started modifying a Metafont. (It's my first time doing it so take this with a grain of salt.)

  1. Find the Metafont source for Computer Modern 10pt, TEXMF-DIST/fonts/source/public/cm/crm10.mf.
  2. COPY this file to a separate working directory where you won't mess up your TeXLive installation.
  3. Go in and change the "thickness" and "breadth" parameters to larger values. Save the file under a new name, e.g., cmthick.mf
    • e.g., line 25: thin_join#:=10/36pt#; % width of extrafine details
  4. Compile the font with METAFONT (see texdoc metafont):
    • mf '\mode=localfont; input cmthick'
    • gftopk cmthick.600gf
  5. Use the new font. Since this was just for demonstration and I don't know what I'm doing, I just did this in Plain TeX. File cmthicktest.tex:

    The quick brown fox jumps over the lazy dog.
    
    \font\cmthick=cmthick
    \cmthick
    
    The quick brown fox jumps over the lazy dog.
    \bye
    
  6. Compiled with tex cmthicktest && dvips cmthicktest && ps2pdf cmthicktest.ps I get the following:

enter image description here

This is just to show that it can be done. I don't know if this is the right way.

  • Using the Concrete Math font seems to be the simplest solution. – Sverre Jan 26 '15 at 17:58
  • 5
    "computer concrete" is indeed darker than computer modern, but there are other differences too -- it's essentially an "egyptian", or square-serif font -- so while there are strong similarities with computer modern, it's really not at all the same. an article by knuth, "typesetting concrete mathematics" was set in concrete roman, and should give a reasonable basis for comparison (even though the on-line copy has been scanned). – barbara beeton Jan 26 '15 at 18:00
  • 3
    @Sverre -- as far as i know, multiple sizes of concrete exist only in metafont form. there are some vector (type 1) versions for vietnamese on ctan in only some sizes. the original question seems to me to be looking for a font to be used in text as well as math, so multiple sizes would definitely be desirable. (the typesetter knuth used for concrete mathematics used metafonts tuned to the exact pixel resolution; vector fonts weren't needed.) – barbara beeton Jan 26 '15 at 18:16
  • 1
    To look like that I think you would have to use whatever printing technology they used instead of a laser printer. Looking at Knuth's "Art of Computer Programming",3rd edition, which was typeset with TeX in Computer Modern, the published version does look darker to me than what I can produce on my printer. – musarithmia Jan 27 '15 at 11:37
  • 1
    See my edit with a basic demonstration of METAFONT. – musarithmia Jan 27 '15 at 12:45
4

I don't remember where this method was found, but I share it here, since this is one of the many questions asking for a fatter computer modern. I hope this is what you look for, it was what I looked for.

In your modes.mf you add:

 mode_def myblacker =
 mode_param (pixels_per_inch, 1200);
 mode_param (blacker, 3.5);
 mode_param (fillin, 0);
 mode_param (o_correction, 1);
 mode_common_setup_;
 enddef;

If you look at the file, you'll probably find where to add it (there is a long list of modes). You might want to change the values to fit your printer and taste. The values given above fitted the printer at my work (and my taste).

Next, run

 fmtutil-sys --byfmt mf

as root. Now you are set to use this mode. The following is a minimal working file:

 \pdfpkresolution=1200
 \pdfpkmode={myblacker}
 \pdfmapfile{}
 \documentclass{article}
 \begin{document}
 Some text, and a formula: $D\tan x=1+\tan^2x$.
 \end{document}

Just compile with pdflatex as usual, and you will hopefully be satisfied.

Two final notes:

1) This method makes your file less portable, since others probably have not added the mode myblacker. In case you need to compile elsewhere, it might be a good idea to use \pdfpkmode={lexmarkr} or some other mode you find in modes.mf that fit your taste. Thus, a minimal working file that needs no preparation is:

 \pdfpkresolution=1200
 \pdfpkmode={lexmarkr}
 \pdfmapfile{}
 \documentclass{article}
 \begin{document}
 Some text, and a formula: $D\tan x=1+\tan^2x$.
 \end{document}

2) I'm a bit disappointed that even though the text in my documents now look fatter and thus more like the paper by wiles that you link to, my mathematical results are still extremely thin in comparison. ;)

  • 1
    This is the best solution!! I didn't notice your solution until the second time I came to this question. Before that I spent hours searching over the internet, reading Metafont documentation, etc... but could not come up with a proper solution. Not only your solution works well, it is also extremely simple! Thanks a lot! – Khue Apr 15 '18 at 18:22
  • I have realized that this solution has a limitation though: it makes all the document blacker and not just the part with computer modern font, which may not be expected. In my document for example the section names are \sffamily and I find that their blacker version is less nice than the normal version. However, this is only a minor issue :) – Khue Apr 17 '18 at 18:06

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .