6

Compile this MWE with PdfLaTeX and with LuaLaTeX:

\documentclass{article}

\usepackage{amsmath}
\usepackage{libertinus}

\begin{document}
\begin{equation*}
\left\lvert
  P \left[
    b = b'
  \middle\vert
    \begin{gathered}
      g \gets G\\
      2 = 1 + 1
    \end{gathered}
  \right] \right\rvert
\end{equation*}
\end{document}

The result with PdfLaTeX is this:

Resut with PdfLaTeX

The vertical bars are nearly as thick and high as the squared brackets. Not completely, but the difference is not so much that it would be visually disturbing.

The result with LuaLaTeX is this:

Result with LuaLaTeX

The vertical bars are too small, but most disturbing is the difference between the thickness of the squared brackets and the thickness of the vertical bars.

Overall, I like the result with LuaLaTex better (mostly because the lowercase g matches the g in text mode), but I would either have thinner squared bracket such that they match the thickness of the vertical bars or vice versa.

How do achieve this? Are \lvert, \rvert and \vert the "correct" commands to be used with unicode-math or are are there successors?

1 Answer 1

5
+200

If you don't like the symbols provided by Libertinus Math, you can load them from another math font you like.

You can select the symbols you want to change with option range=.

Let's try Fira Math:

\documentclass{article}

\usepackage{amsmath}
\usepackage{libertinus-otf}
\setmathfont[range={\vert,\lbrack,\rbrack}]{FiraMath-Regular.otf}
\begin{document}
\begin{equation*}
\left\lvert
  P \left[
    b = b'
  \middle\vert
    \begin{gathered}
      g \gets G\\
      2 = 1 + 1
    \end{gathered}
  \right] \right\rvert
\end{equation*}
\end{document}

enter image description here

Or maybe Latin Modern Math fits better:

\documentclass{article}

\usepackage{amsmath}
\usepackage{libertinus-otf}
\setmathfont[range={\vert,\lbrack,\rbrack}]{Latin Modern Math}
\begin{document}
\begin{equation*}
\left\lvert
  P \left[
    b = b'
  \middle\vert
    \begin{gathered}
      g \gets G\\
      2 = 1 + 1
    \end{gathered}
  \right] \right\rvert
\end{equation*}
\end{document}

enter image description here

4
  • I like your code. But every command is it too thick that looks like a bold character?
    – Sebastiano
    Commented Feb 20, 2020 at 21:53
  • I voted for it :); but if you find something where \lvert and \rvert is less thick aesthetically it might be better.
    – Sebastiano
    Commented Feb 20, 2020 at 21:58
  • 1
    @Sebastiano got it
    – DG'
    Commented Feb 20, 2020 at 22:08
  • Nice answer, didn't know you could use a font selectively like this. TIL.
    – Jason
    Commented Feb 21, 2020 at 16:08

You must log in to answer this question.

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