# Problem with lmodern font and paired delimiter / overline

I'm currently writing my bachelor thesis and forgot to include \usepackage[T1]{fontenc}. But I'm using \usepackage[utf8]{inputenc} and \usepackage{microtype}. When I included \usepackage[T1]{fontenc} I needed to choose a scalable font, so I chose \usepackage{lmodern}. Now I have a few new problems. The hat from $\widehat{K}$is to large. I solved this with a new command:

\usepackage{accents}
\DeclareMathSymbol{\widehatsym}{\mathord}{largesymbols}{"62}
\newcommand\lowerwidehatsym{%
\text{\smash{\raisebox{-1.2ex}{%
$\widehatsym$}}}}
\newcommand\fixwidehat[1]{%
\mathchoice
{\accentset{\displaystyle\lowerwidehatsym}{#1}}
{\accentset{\textstyle\lowerwidehatsym}{#1}}
{\accentset{\scriptstyle\lowerwidehatsym}{#1}}
{\accentset{\scriptscriptstyle\lowerwidehatsym}{#1}}
}


Now I have the following questions/problems:

1. I use $\fixwidehat{}$ with $\overline{\fixwidehat{K}}$ but the hat crosses the line.
2. My absolute-value-command \newcommand{\abs}[1]{\left\vert#1\right\vert} doesn't scale the size when $\fixwidehat{}$is used.
3. But $\abs{e^{i*t*\omega}}$ is compared to the normal computer modern font not well sized. It's to high.

I was very happy with my results before including \usepackage{lmodern} and just want to adjust it to look similar to the old version. Could you please help me? I have to print the thesis in a little more then a week and I'm currently really frustrated with LaTeX.

Edit: Here is a minimal working example:

\documentclass[
11pt,
a4paper,
twoside = false,
toc=chapterentrywithdots,
toc=bibliography]{scrbook}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{lmodern}

\usepackage{amsmath}
\usepackage{amsthm, thmtools}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{accents}
\DeclareMathSymbol{\widehatsym}{\mathord}{largesymbols}{"62}
\newcommand\lowerwidehatsym{%
\text{\smash{\raisebox{-1.2ex}{%
$\widehatsym$}}}}
\newcommand\fixwidehat[1]{%
\mathchoice
{\accentset{\displaystyle\lowerwidehatsym}{#1}}
{\accentset{\textstyle\lowerwidehatsym}{#1}}
{\accentset{\scriptstyle\lowerwidehatsym}{#1}}
{\accentset{\scriptscriptstyle\lowerwidehatsym}{#1}}
}

\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\newcommand{\abs}[1]{\left\vert#1\right\vert}

\usepackage[pdftex]{graphicx}
\usepackage{tikz}
\usepackage[final,babel,tracking=true,kerning=true,spacing=true]{microtype}

\begin{document}
\begin{align*}
\overline{\fixwidehat{K}} \\
\abs{\fixwidehat{K}} \\
\norm{\fixwidehat{K}} \\
\abs{e^{it\omega}}
\end{align*}
\end{document}

• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – dexteritas Sep 16 '17 at 11:49
• You seem to be asking two [or more] unrelated questions, here. On TeX.SX, we try to keep unrelated questions on separate pages. If you have multiple questions that are unrelated to one another, you should ask each in a separate TeX.SX "question". You'll stand a better chance of getting a satisfactory answer to each of your questions. – dexteritas Sep 16 '17 at 11:50
• I have added a minimal working example but because the problems are all caused by the use of lmodern I think they are related and I don't know how to ask them in multiple questions. – Conny Sep 16 '17 at 12:02

You've been bitten by the problem described in Problems using lmodern with very small font sizes and the solution is similar.

\documentclass[
11pt,
a4paper,
twoside = false,
toc=chapterentrywithdots,
toc=bibliography,
]{scrbook}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{lmodern}

\usepackage{amsmath}
\usepackage{amsthm, thmtools}
\usepackage{amsfonts}
\usepackage{amssymb}

\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\newcommand{\abs}[1]{\left\vert#1\right\vert}

\usepackage{graphicx}
\usepackage{tikz}
\usepackage[final,babel,tracking=true,kerning=true,spacing=true]{microtype}

\DeclareFontShape{OMX}{cmex}{m}{n}{
<-7.5> cmex7
<7.5-8.5> cmex8
<8.5-9.5> cmex9
<9.5-> cmex10
}{}
\SetSymbolFont{largesymbols}{normal}{OMX}{cmex}{m}{n}
\SetSymbolFont{largesymbols}{bold}  {OMX}{cmex}{m}{n}

\begin{document}
\begin{gather*}
\overline{\widehat{K}} \\
\abs{\widehat{K}} \\
\norm{\widehat{K}} \\
\abs{e^{it\omega}} \\
X_{\widehat{x}_{\widehat{x}}}
\end{gather*}
\end{document}


For comparison, the output without the fix.

In my opinion you should not use automatic \left and \right for \abs and \norm: the second and third line show why. Check the documentation of mathtools for better methods. For instance, loading mathtools and issuing

\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}


you can look at the output of

$\norm{\widehat{K}}+\norm[\big]{\widehat{K}} +\norm[\Big]{\widehat{K}}+\norm*{\widehat{K}}$


As you see, the first is quite right, maybe you can prefer the second, but the third and fourth (which corresponds exactly to your definition) have definitely too large fences.

Final note: I removed the pdftex option to graphicx; do it yourself as well. It's not related to the problem, but it's better policy.

• Thanks a lot for the quick reply! With this code all the changes which happened by changing to lmodern are corrected, am I right? I know it's not the best to use \leftand \right, but I didn't want to specify the size of \absand \normevery time I use it. Is there a way that automatically sizes it to match the current height? If not I will change it manually. – Conny Sep 16 '17 at 14:05
• @LauraC As you see, the only automatic way produces too large fences. Quality typesetting requires some handicraft. – egreg Sep 16 '17 at 14:09
• Thanks, I already feared that I have to do it manually. But for know I'm happy that all the other things now work with lmodern and that I can proceed with correcting my thesis. Thanks a lot! – Conny Sep 16 '17 at 14:12