[Tex/LaTex] First letter bold compatible with hyphenation

boldhyphenation

I ve been trying many solutions found on stack exchange to have a command that make bold the first letter of a word. All of them work. With every solution I have tried I have an hyphenation problem with the word having the first letter bolded. It seems that the hyphenation cannot be done (as shown on the picture with de word Désambiguisation at the end of the first line).

enter image description here

Do you have any other alternative to have first bold letter while considering hyphenation ?

Best Answer

The problem is that words subject to automatic hyphenation must be formed with letters in the same font (LuaTeX has not this limitation).

I don't know what macro you're using for emboldening the first letter, so I'll make one on the spot.

Automatic hyphenation is reenabled after the initial, but of course this could lead to wrong results; if false hyphenation results, add \- in the appropriate spots. For languages such as French or Italian, where hyphenation is mostly at syllable boundaries and syllables are defined grammatically, it shouldn't be a big problem, except in case the word has some prefix that should be taken care of by hyphenation in “nonstandard” way. Which might be the case with Désambiguïsation.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}

\newcommand{\fb}[1]{\dofb#1}
\newcommand{\dofb}[1]{\textbf{#1}\nobreak\hspace{0pt}}

\begin{document}

Dans notre approche, nous avons défini quatre types de
méta critère: \fb{Désambiguïsation}, \fb{Temporel},
\fb{Contenu} et \fb{Autre}. Pour évaluer l'apport de
chacun des types de méta critère que nous avons mis en
place, nous avons évalué notre système sur toutes les
possibilités d'association (\mbox{c.-à-d.}, 15~possibilités).

\end{document}

enter image description here

Warning

In my opinion you should not allow automatic hyphenation in these cases. Since you're not going to use this first-letter-bold words very often, leave to the final revision where to appropriately add \-.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}

\newcommand{\fb}[1]{\dofb#1}
\newcommand{\dofb}[1]{\textbf{#1}}

\begin{document}

Dans notre approche, nous avons défini quatre types de
méta critère: \fb{Désam\-biguïsation}, \fb{Temporel},
\fb{Contenu} et \fb{Autre}. Pour évaluer l'apport de
chacun des types de méta critère que nous avons mis en
place, nous avons évalué notre système sur toutes les
possibilités d'association (\mbox{c.-à-d.}, 15~possibilités).

\end{document}
Related Question