1

I am writing a book in French about spoonerism. The book should have 2 part one normal and one with the solutions given by emphasising part of the words.

It seems that sometimes words overfill outside the text body. I mainly noticed that with the EBGaramond font (which I want to use) but not with default font (Computer Modern).

Garamond Default

Here is the MWE:

\documentclass[12pt]{article}

\usepackage[english,francais]{babel}
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{xstring}
\usepackage{ebgaramond}

\newcommand{\s}[1]{\IfStrEq{~}{#1}{}{#1}}
\newcommand{\scol}[1]{%
  \begingroup%
  \color{red}{%
    \IfStrEq{~}{#1}%
            {\textbf{\textperiodcentered}}%
            {#1}%
  }%
  \endgroup%
}%

%http://connect.lulu.com/t5/Mise-en-page-du-corpus/Comment-faire-pour-que-mon-contenu-s-%C3%A9tale-jusqu-aux-bords-de-la/ta-p/33461
\usepackage[
  showframe,
  % Digest
  paperwidth=13.97cm,
  paperheight=21.59cm,
  bindingoffset=0.625in,
  hmargin={0.0in,0.5in},
  vmargin={0.5in,0.5in},
  includeall, nomarginpar, twoside,
  ignorehead=false, ignorefoot=false, ignoremp=false,
  headsep=0.5em,
  footskip=1.2em,
]{geometry}

\usepackage{layout}

\setlength{\parindent}{0pt}

\newcommand{\aspoonerism}{%
  An English one:\\
  You have \s{~}hissed all my \s{m}ystery lectures. You have \s{t}asted a whole
  \s{w}orm. Please leave Oxford on the next \s{t}own \s{d}rain.

  A French one:\\
  \textsc{Lecteurs}: \og{}\s{A}cculons ces hommes d'\s{en}fer \s{fêl}és rêvant de
  \s{radicalis}ation!\fg{}
}%

\begin{document}

\section{Spoonerism}
\aspoonerism
\section{Solutions}
\renewcommand{\s}{\scol}
\aspoonerism

\end{document}

Of course I can force an hyphen using \- such as: \s{radicalis}a\-tion and get it work. But that is not a solution since if I change the paper width, I would have to re-hyphen all words which is an horrible task and decrease the tex code readability.

enter image description here

Is there an easy solution to make the hyphen work in this case?

Thanks

EDIT:

After running the source through LuaLaTeX the hyphen is correct, but the paper is not. I didn't see any restriction in the geometry package. But I found this http://tug.org/pipermail/tex-live/2016-May/038560.html.

Fact is that I want to use a TeX that support colored text and hyphen and OTF fonts.

enter image description here

EDIT2:

As specified at https://www.tug.org/pipermail/luatex/2016-May/005906.html there is a bug in TexLive 2016. Thus adding \usepackage{luatex85} helps.

EDIT3:

Using \usepackage{ebgaramond} Seems to work. But if I switch to fontspec to create fake bold fonts I still got the problem:

\setmainfont[
  Numbers=Lining,
  Scale=1.00,
  Extension=.otf,
  Ligatures = TeX ,
  UprightFont    = *-Regular,
  ItalicFont     = *-Italic,
  BoldItalicFont = *-Italic,
  BoldItalicFeatures = {FakeBold=3},
  ,]{EBGaramond12}%

EDIT4:

I process this with lualatex:

\documentclass[12pt]{book}

\usepackage{luatex85}
\usepackage[english,francais]{babel}
\usepackage{xcolor}
\usepackage{xstring}
\usepackage{ebgaramond}

\newcommand{\s}[1]{\IfStrEq{~}{#1}{}{#1}}
\newcommand{\scol}[1]{%
  \begingroup%
  \color{red}{%
    \IfStrEq{~}{#1}%
        {\textbf{\textperiodcentered}\nobreak\hspace{0pt}}%
            {#1}%
  }%
  \endgroup%
}%
\usepackage[
  showframe,
  % Digest
  paperwidth=13.97cm,
  paperheight=21.59cm,
  bindingoffset=0.625in,
  hmargin={0.0in,0.5in},
  vmargin={0.5in,0.5in},
  includeall, nomarginpar, twoside,
  ignorehead=false, ignorefoot=false, ignoremp=false,
  headsep=0.5em,
  footskip=1.2em,
]{geometry}


\setlength{\parindent}{0pt}

\newcommand{\aspoonerism}{
  \og{}Ma quen\s{e}lle n'est jamais r\s{u}de!\fg{} Le \s{ch}icaneur
  fa\s{r}aud exhibe sa quene\s{ll}e ho\s{nn}ie, quenelle d'un ty\s{p}e trop
  fri\s{qu}é, et se tord le \s{c}ou en \s{b}afouillant. Faut-il saisir le
  gredin fou de quenelles ou faire cesser pendant plus d'une minute ce comique
  haineux qui parle de paix à de gros nases\s{~} au petit Q\s{I}?
  }


\begin{document}
\section{spoonerism}
\aspoonerism
\section{solution}
\renewcommand{\s}{\scol}
\aspoonerism
\end{document}

And it is still not working. Still do not have any viable solution.

The complete log is:

This is LuaTeX, Version 0.95.0 (TeX Live 2016)
 restricted system commands enabled.
(./m.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/book.cls
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/bk12.clo))
(/usr/local/texlive/2016/texmf-dist/tex/generic/luatex85/luatex85.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/babel/babel.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/babel/luababel.def)
(/usr/local/texlive/2016/texmf-dist/tex/generic/babel-english/english.ldf
(/usr/local/texlive/2016/texmf-dist/tex/generic/babel/babel.def
(/usr/local/texlive/2016/texmf-dist/tex/generic/babel/luababel.def)))
(/usr/local/texlive/2016/texmf-dist/tex/generic/babel-french/frenchb.ldf
(/usr/local/texlive/2016/texmf-dist/tex/generic/hyph-utf8/loadhyph/loadhyph-fr.
tex UTF-8 French hyphenation patterns
(/usr/local/texlive/2016/texmf-dist/tex/generic/hyph-utf8/patterns/tex/hyph-fr.
tex)
(/usr/local/texlive/2016/texmf-dist/tex/generic/hyph-utf8/patterns/quote/hyph-q
uote-fr.tex))))
(/usr/local/texlive/2016/texmf-dist/tex/latex/carlisle/scalefnt.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(/usr/local/texlive/2016/texmf-dist/tex/lualatex/luatex-def/luatex.def
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)))
(/usr/local/texlive/2016/texmf-dist/tex/generic/xstring/xstring.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/xstring/xstring.tex))
(/usr/local/texlive/2016/texmf-dist/tex/latex/ebgaramond/ebgaramond.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2016/texmf-dist/tex/generic/xkeyval/xkvutils.tex)))
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/textcomp.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/ts1enc.def))
(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3kernel/l3pdfmode.def))
(/usr/local/texlive/2016/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/local/texlive/2016/texmf-dist/tex/luatex/luaotfload/luaotfload.sty(using
write cache: /Users/renard/Library/texlive/2016/texmf-var/luatex-cache/generic)
(using read cache: /usr/local/texlive/2016/texmf-var/luatex-cache/generic /User
s/renard/Library/texlive/2016/texmf-var/luatex-cache/generic)
luaotfload | main : initialization completed in 0.137 seconds)
(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/euenc/eu2enc.def)
(/usr/local/texlive/2016/texmf-dist/tex/latex/euenc/eu2lmr.fd)(compiling luc: /
usr/local/texlive/2016/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regul
ar.luc)(load luc: /Users/renard/Library/texlive/2016/texmf-var/luatex-cache/gen
eric/fonts/otl/lmroman10-regular.luc))(compiling luc: /usr/local/texlive/2016/t
exmf-var/luatex-cache/generic/fonts/otl/lmroman12-regular.luc)(load luc: /Users
/renard/Library/texlive/2016/texmf-var/luatex-cache/generic/fonts/otl/lmroman12
-regular.luc)
(/usr/local/texlive/2016/texmf-dist/tex/xelatex/xunicode/xunicode.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/tipa/t3enc.def(compiling luc: /us
r/local/texlive/2016/texmf-var/luatex-cache/generic/fonts/otl/lmromanslant12-re
gular.luc)(load luc: /Users/renard/Library/texlive/2016/texmf-var/luatex-cache/
generic/fonts/otl/lmromanslant12-regular.luc)(compiling luc: /usr/local/texlive
/2016/texmf-var/luatex-cache/generic/fonts/otl/lmroman12-italic.luc)(load luc:
/Users/renard/Library/texlive/2016/texmf-var/luatex-cache/generic/fonts/otl/lmr
oman12-italic.luc)(compiling luc: /usr/local/texlive/2016/texmf-var/luatex-cach
e/generic/fonts/otl/lmroman12-bold.luc)(load luc: /Users/renard/Library/texlive
/2016/texmf-var/luatex-cache/generic/fonts/otl/lmroman12-bold.luc)
(/usr/local/texlive/2016/texmf-dist/tex/latex/euenc/eu2lmss.fd)(compiling luc:
/usr/local/texlive/2016/texmf-var/luatex-cache/generic/fonts/otl/lmsans12-regul
ar.luc)(load luc: /Users/renard/Library/texlive/2016/texmf-var/luatex-cache/gen
eric/fonts/otl/lmsans12-regular.luc))
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg))))
(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec.cfg)))(compilin
g luc: /usr/local/texlive/2016/texmf-var/luatex-cache/generic/fonts/otl/ebgaram
ond12-regular.luc)(load luc: /Users/renard/Library/texlive/2016/texmf-var/luate
x-cache/generic/fonts/otl/ebgaramond12-regular.luc)(compiling luc: /usr/local/t
exlive/2016/texmf-var/luatex-cache/generic/fonts/otl/ebgaramond12-italic.luc)(l
oad luc: /Users/renard/Library/texlive/2016/texmf-var/luatex-cache/generic/font
s/otl/ebgaramond12-italic.luc)(compiling luc: /usr/local/texlive/2016/texmf-var
/luatex-cache/generic/fonts/otl/ebgaramondinitials.luc)(load luc: /Users/renard
/Library/texlive/2016/texmf-var/luatex-cache/generic/fonts/otl/ebgaramondinitia
ls.luc)) (/usr/local/texlive/2016/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifvtex.sty)) (./m.aux)
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/ts1cmr.fd)
(/usr/local/texlive/2016/texmf-dist/tex/latex/tipa/t3cmr.fd)
(/usr/local/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/grfext.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/luatex-loader.sty
(/usr/local/texlive/2016/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/atbegshi.sty)
Overfull \hbox (9.63983pt too wide) in paragraph at lines 52--53
[]\EU2/EBGaramond12(0)/bx/n/12 « Ma quen[]e[]lle n’est ja-mais r[]u[]de !
» Le []ch[]ica-neur fa[]r[]aud ex-hibe sa quene[]ll[]e
[1{/usr/local/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./m.aux))
(see the transcript file for additional information)
 572 words of node memory still in use:
   4 hlist, 1 vlist, 1 rule, 14 glue, 1 penalty, 34 attribute, 53 glue_spec, 9
attribute_list, 1 write nodes
   avail lists: 2:340,3:31,4:29,5:36,6:571,7:181,8:9,9:33,10:2,11:41
</usr/local/texlive/2016/texmf-dist/fonts/opentype/public/ebgaramond/EBGaramond
12-Regular.otf></usr/local/texlive/2016/texmf-dist/fonts/opentype/public/ebgara
mond/EBGaramond12-Italic.otf>
Output written on m.pdf (1 page, 11328 bytes).
Transcript written on m.log.

enter image description here

  • 1
    Which TeX distribution, and which TeX engine (XeTeX or LuaTeX) do you use? The reason I ask is that I'm unable to reproduce the issue you raise on my system (MacTeX2016, LuaTeX 0.95, all recent updates installed) and the ebgaramond package. – Mico Sep 6 '16 at 18:54
  • 2
    with luatex I get hyphenation in the coloured examples but not with xetex (texlive 2016) which system are you using? – David Carlisle Sep 6 '16 at 19:00
  • 1
    XeTeX has the same restrictions as pdftex about hyphenation: a change in color will make the word not hyphenatable; this isn't the case with LuaTeX. – egreg Sep 6 '16 at 19:33
  • I am using MacTeX2016 and xelatex. – renard Sep 6 '16 at 20:27
  • I suspected something like that. But with LuaLaTeX the geometry package is not correctly honored (mainly for the paperwidth) – renard Sep 6 '16 at 20:36

Your Answer

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

Browse other questions tagged or ask your own question.