1

I have used the package \usepackage{lmodern} to increase the font size of the my chapter title. Due to that, I am getting strange characters in my text.

Before using the package the text looked like this:

enter image description here

Now it looks like this:

enter image description here

My code in part is as under:

\documentclass[a4paper,12pt,oneside]{report}
\usepackage[left=3.81cm,right=2.54cm,top=2.54cm,bottom=2.54cm]{geometry}

\usepackage{sectsty,lmodern}

\chapternumberfont{\fontsize{36pt}{32pt}\selectfont}

\chaptertitlefont{\fontsize{36pt}{35pt}\selectfont}

Any ideas how to rectify that?

  • How are you typesetting the document? What file encoding are you using? Are you using a 2018 TeX Distribution? – Herb Schulz Sep 1 '18 at 20:36
  • Sorry, I am new to this. can you plz tell me where to fetch this information. I am using overleaf btw. – Tasie Sep 1 '18 at 20:40
  • that is unrelated to the font choice, it looks like you have saved the file in UTF-8 encoding but declared to TeX that it is in latin1 – David Carlisle Sep 1 '18 at 21:13
4

You have an endash at this places and your document is utf8 encoded. For pdflatex this means it sees the bytes "E2 "80 "93 You are using an older latex which doesn't declare utf8 by default. As your document is neither using inputenc nor fontenc the default font cmr, which has empty slots at this positions simply shows nothing. lmodern has glyphs there and shows them.

Solution: Declare your encoding as utf8 or use a newer latex. You should also load fontenc.

\documentclass[a4paper, english]{article}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}

some text – with endash

\end{document} 
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.