2

I want to make bold underline.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{contour}
\usepackage{ulem}

\renewcommand{\ULdepth}{1.8pt}
\contourlength{0.8pt}

\newcommand{\myuline}[1]{%
  \uline{\phantom{#1}}%
  \llap{\contour{white}{#1}}%
}
\begin{document}

\myuline{bold underline}

\end{document}
2
  • That's not the problem. The problem is that the underline is not one but two lines. @miko
    – cufcuf
    Sep 19 at 8:49
  • I edited the post
    – cufcuf
    Sep 19 at 9:06
2

(WARNING: This answer addresses the initial format of the posting above. After posting this answer, I noticed that the OP had radically changed the question's setup and associated code. For instance, the \myunder macros is no longer either defined or used. Hence, this answer may not be of much use to either the OP or to future readers of this posting. Oh well.)

Even if you were to change the vertical offset in \dunderline from 0.5pt to 0.4pt, the macro \myunder would still suffer from two major defects:

  • If the argument of \myunder contains a letter that reaches below the baseline -- such as g, j, p, q, and y -- the macro draws two separate thin lines rather than one thick line. Moreover, the upper thin line intersects with the letter(s) that have a component that falls below the baseline. (I think the \smash directive may be responsible to this unfortunate property.)

  • If two consecutive \myunder directives occur, the whitespace between the two groups of words is too big.

Rather than tweak the definition of \myunder, I'd just load the ulem package and change the value of \ULthickness (default value: 0.4pt) via a \renewcommand instruction -- say, \renewcommand\ULthickness{.8pt}.

enter image description here

    \documentclass{article}
    \usepackage[utf8]{inputenc}
    \newcommand\dunderline[2][.4pt]{ % use 0.4pt, not 0.5pt
    \raisebox{-#1}{\underline{\raisebox{#1}{\smash{\underline{#2}}}}}}
    \newcommand{\myunder}{\dunderline}
    
    \usepackage[normalem]{ulem} % for "\uline" macro
    
    
    \begin{document}
    
    Using \texttt{\string\myunder}
    
    \myunder{thick underlining} \myunder{text}

    
    \medskip
    Using \texttt{\string\uline}
    
    \uline{thin underlinining} \uline{text}
    
    \renewcommand\ULthickness{.8pt} % <-- double the default width
    
    \uline{thick underlinining} \uline{text}
    
    \end{document}
1
  • Thank you for solving my problem @Mico
    – cufcuf
    Sep 19 at 9:17
2

Use the package bm

d

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{contour}
\usepackage{ulem}

\usepackage{bm} % added <<<<<<<<

\renewcommand{\ULdepth}{1.8pt}
\contourlength{0.8pt}

\newcommand{\myuline}[1]{%
    \bfseries %<<<<<<<<<<<<<<<<
    \uline{\phantom{#1}}%
    \llap{\contour{white}{#1}}%
}
\begin{document}
    
    \myuline{bold underline} 
    \bigskip
    
    \myuline{bold linguistic}
    
\end{document}

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.