6

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?

Eomnden
  • 93
  • 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 09 '18 at 12:35

3 Answers3

4

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).

AlexG
  • 54,894
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.

egreg
  • 1,121,712
1

Here is an expl3 version of @AlexG's answer.

\documentclass{article}

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

\ExplSyntaxOn \char_set_catcode_active:n { `\· } \cs_new_protected:Npn · { \ensuremath\cdot } \ExplSyntaxOff

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

enter image description here

Jinwen
  • 8,518