0

I know, it's ugly and seems stupid, but I need to redefine like that. I try a lot of things (\edef, \expandafter...) Nothing seems to work. No break line.

    \documentclass{article}
\usepackage{ulem}
\def\texteSouligne#1{\uline{#1}}
\def\texteGras#1{{\textbf{#1}}}
\def\texteItalique#1{{\it #1}}

\begin{document}
Voici du texte \texteSouligne{souligné \texteItalique{et eded  e defn même temps italique bla blabla blabla blabla blabla blabla blabla blabla bla.}}

Voici du texte \texteSouligne{souligné \texteGras{et en même bla blabla blabla blabla blabla blabla blabla blabla blabla blabla bla temps gras.}}

\texteSouligne{Voici du texte souligné,  bla bla blabla bla blabla bla blabla bla blabla bla blabla bla blabla bla bla \texteGras{en gras \texteItalique{et en même temps italique.}}}
\end{document}
  • You say that you want to redefine ulem macros. 1st question: Why? 2nd question: What did you do? Third question: Why using \it which is outdated?. And I doubt that ulem macros are expandable to use it with \edef – user31729 Dec 1 '17 at 19:02
  • Related to underlining: tex.stackexchange.com/questions/126291/… – Steven B. Segletes Dec 1 '17 at 19:10
  • no related, I've already read this Q/A – nikopol Dec 1 '17 at 19:26
5

This is a restriction of package ulem. From its documentation, section "3 Complications":

One important incompatibility with braces and macro replacement: All the text in braces or coming from a macro is typeset in a box (as if in \mbox). Consequently, braces will suppress stretching and line-breaking in the text they enclose.

Package soul

The example from the question can be typeset with package soul. It has its own limitations, see its documentation. The following example uses package soulutf8 to add UTF-8 support for 8-bit TeX engines.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{soulutf8}
\newcommand{\texteSouligne}[1]{\ul{#1}}
\newcommand{\texteGras}[1]{\textbf{#1}}
\newcommand{\texteItalique}[1]{\textit{#1}}

\soulregister{\texteGras}{1}
\soulregister{\texteItalique}{1}

\begin{document}

Voici du texte \texteSouligne{souligné \texteItalique{et eded  e defn même
temps italique bla blabla blabla blabla blabla blabla blabla blabla bla.}}

Voici du texte \texteSouligne{souligné \texteGras{et en même bla blabla
blabla blabla blabla blabla blabla blabla blabla blabla bla temps gras.}}

\texteSouligne{Voici du texte souligné,  bla bla blabla bla blabla bla
blabla bla blabla bla blabla bla blabla bla bla \texteGras{en gras
\texteItalique{et en même temps italique.}}}

\end{document}

Result

  • Thanks, I have tried soul package but not soulutf8. – nikopol Dec 1 '17 at 19:29

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.