1

When I switched from Calibri to Cambria in LuaLaTeX, a \middle/ lost its correct size. I then tinkered with combinations of fontspec, unicode-math and mathastext, but none seems to work. I didn't play around with Calibri, as I don't want to use that anymore:

\documentclass{scrartcl}

%% ---------------------------------------------------------
%% Variant A: OK, except not Cambria

%\usepackage[T1]{fontenc}
%\usepackage{lmodern}
%\usepackage{amsmath}

%% ---------------------------------------------------------
%% Variant B: not OK, dash to small

\usepackage{fontspec}
\setmainfont{Cambria}[BoldFont = CambriaB]
\setsansfont{Corbel}[Numbers = Lining]
\setmonofont{Consolas}[Scale = 0.93]
\usepackage{unicode-math}
\setmathfont{Cambria Math} % needs unicode-math?
\usepackage{amsmath}

%% ---------------------------------------------------------
%% Variant C: not OK, wrong math font

%\usepackage[no-math]{fontspec}
%\setmainfont{Cambria}[BoldFont = CambriaB]
%\setsansfont{Corbel}[Numbers = Lining]
%\setmonofont{Consolas}[Scale = 0.93]
%\usepackage{amsmath}

%% ---------------------------------------------------------
%% Variant D: dash and parentheses OK, but wrong math font for sum and fraction line

%\usepackage[no-math]{fontspec}
%\setmainfont{Cambria}[BoldFont = CambriaB]
%\setsansfont{Corbel}[Numbers = Lining]
%\setmonofont{Consolas}[Scale = 0.93]
%\usepackage{amsmath}
%\usepackage[italic]{mathastext}

\begin{document}
Some math stuff:
\begin{gather}
    E = m c^2\\
    \sum_{i = 1}^{n} i = \frac12 n (n + 1)\\
    \left.\left(86400\,\text{s}\right)\middle/\!\left(86400\,\frac{\text{s}}{\text{d}}\right)\right. = 1\,\text{d}
\end{gather}
\end{document}
2
  • Welcome to TeX.SE! Did you receive error messages? If yes please show them...
    – Mensch
    Commented Feb 17, 2023 at 16:35
  • @Mensch no, it just doesn't stretch. Commented Feb 17, 2023 at 16:44

1 Answer 1

2

The fraction slash U+2044 is set up as extendable in Cambria Math, but unicode-math doesn't define it as a delimiter, you can access it directly:

enter image description here

\documentclass{scrartcl}

%% ---------------------------------------------------------
%% Variant A: OK, except not Cambria

%\usepackage[T1]{fontenc}
%\usepackage{lmodern}
%\usepackage{amsmath}

%% ---------------------------------------------------------
%% Variant B: not OK, dash to small

\usepackage{fontspec}
\setmainfont{Cambria}%[BoldFont = CambriaB]
\setsansfont{Corbel}[Numbers = Lining]
\setmonofont{Consolas}[Scale = 0.93]
\usepackage{unicode-math}
\setmathfont{Cambria Math} % needs unicode-math?
\usepackage{amsmath}

%% ---------------------------------------------------------
%% Variant C: not OK, wrong math font

%\usepackage[no-math]{fontspec}
%\setmainfont{Cambria}[BoldFont = CambriaB]
%\setsansfont{Corbel}[Numbers = Lining]
%\setmonofont{Consolas}[Scale = 0.93]
%\usepackage{amsmath}

%% ---------------------------------------------------------
%% Variant D: dash and parentheses OK, but wrong math font for sum and fraction line

%\usepackage[no-math]{fontspec}
%\setmainfont{Cambria}[BoldFont = CambriaB]
%\setsansfont{Corbel}[Numbers = Lining]
%\setmonofont{Consolas}[Scale = 0.93]
%\usepackage{amsmath}
%\usepackage[italic]{mathastext}

\begin{document}


Some math stuff:
\begin{gather}
    E = m c^2\\
    \sum_{i = 1}^{n} i = \frac12 n (n + 1)\\
    \left.\left(86400\,\text{s}\right)\middle/\!\left(86400\,\frac{\text{s}}{\text{d}}\right)\right. = 1\,\text{d}\\
    \left.\left(86400\,\text{s}\right)\middle\fracslash\!\left(86400\,\frac{\text{s}}{\text{d}}\right)\right. = 1\,\text{d}\\
    \left.\left(86400\,\text{s}\right)\middle\divslash\!\left(86400\,\frac{\text{s}}{\text{d}}\right)\right. = 1\,\text{d}\\
    \left.\left(86400\,\text{s}\right)\middle\Udelimiter 0 0 "2044\!\left(86400\,\frac{\text{s}}{\text{d}}\right)\right. = 1\,\text{d}
\end{gather}
\end{document}
2
  • Thanks! Is that a common thing with system wide fonts, or rather Cambria specific?
    – ehak
    Commented Feb 20, 2023 at 9:48
  • @ehak Cambria specific, Opentype Math is still somewhat experimental and fonts vary in supported features more than you might hope, Commented Feb 20, 2023 at 9:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .