4

In French, the character “·” (U+00B7) is sometimes used for gender-neutral language. It works well with pdflatex and UTF-8:

% !TEX TS-program = pdflatexmk
% !TEX encoding = UTF-8 Unicode

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}

\begin{document}
Bonjour à tou·te·s!
\end{document}

pdflatex

But if I use lualatex, polyglossia and fontspec with this code

% !TEX TS-program = lualatex
% !TEX encoding = UTF-8 Unicode

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{french}

\begin{document}
Bonjour à tou·te·s!
\end{document}

lualatex

It doesn't work anymore.

How to use interpuncts with LuaLaTeX, polyglossia and fontspec?

  • The problem is in the font, with another e.g. Arial the spacing looks ok. So imho the best would be to patch the font and change the width of the char. – Ulrike Fischer Mar 9 '18 at 12:35
3

I would suggest the following:

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{french}

%\catcode`\·=13 \def\cdottext{$\cdot$} \let·\cdottext
\catcode`\·=13 \def\cdottext{\ensuremath\cdot} \let·\cdottext % @Manuel; more robust

\begin{document}
Bonjour à tou·te·s!
\end{document}

It makes · active and \lets it insert a \cdot (instead of the possibly wrong glyph from the font file).

| improve this answer | |
  • It works with LuaLaTeX, polyglossia and fontspec! – Eomnden Mar 9 '18 at 12:09
  • But not with PdfLaTeX . Hope this doesn't matter. – AlexG Mar 9 '18 at 12:10
  • 2
    With pdfTeX you can use inputenc and \DeclareUnicodeCharacter{B7}{\ensuremath\cdot}. – Manuel Mar 9 '18 at 12:17
  • Thank you Manuel. This is perhaps the more elegant way. Interestingly this does not work with LuaLaTeX; undefined \DeclareUnicodeCharacter. – AlexG Mar 9 '18 at 12:19
  • @Eomnden : Thanks, I corrected the loaded packages. – AlexG Mar 9 '18 at 12:53
3

The character in the Latin Modern font is wrong for the width and, perhaps, the height.

\documentclass{article}
\usepackage{ifxetex,ifluatex}
\newif\ifunicode
\ifxetex\unicodetrue\else\ifluatex\unicodetrue\fi\fi

\ifunicode
  \usepackage{fontspec}
  \usepackage{polyglossia}
  \setmainlanguage{french}
\else
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage[french]{babel}
\fi

\usepackage{newunicodechar}

\ifunicode
% fix middle dot in Latin Modern
\newunicodechar{·}{\makebox[0.27em]{·}}
\fi

\begin{document}

Bonjour à tou·te·s!

\end{document}

Run with LuaLaTeX

enter image description here

Run with pdflatex

enter image description here

Lowering the dot with LuaLaTeX or XeLaTeX

Change \newunicodechar{·}{\makebox[0.27em]{·}} into

\newunicodechar{·}{\ensuremath{{\cdot}}}

enter image description here

Just for comparison, if LuaLaTeX is used with main font set to Libertinus Serif, we get, with no \newunicodechar fix,

enter image description here

Different fix

Another possibility is to take the middle dot from another font. If we add

\newfontfamily{\cmu}{CMU Serif}

and do

\newunicodechar{·}{{\cmu ·}}

the output is

enter image description here

A bit more complicated would be to adapt it also to the sans serif family.

| improve this answer | |
  • Yeah, \cdot seems to be the best replacement, indeed. – AlexG Mar 9 '18 at 12:58

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.