7

MWE:

% !TeX program = xelatex
\documentclass{article}
    \usepackage{libertinus}
    \renewcommand{\epsilon}{\varepsilon}

\begin{document}
    This is \texttt{varepsilon}: $\varepsilon$.

    This is \texttt{epsilon}, which should be looked the same as \texttt{varepsilon} $\epsilon$.
\end{document}

enter image description here

I'm using XeLaTeX. I can't redefine epsilon to varepsilon, as in the picture above. However, if I switch to pdfLaTeX, this does not happen.

For some reason, I have to use XeLaTeX. How can I modify my code to get the variant ε when I enter epsilon? Thanks for your help.

2 Answers 2

6

You need to move the instruction \renewcommand{\epsilon}{\varepsilon} to after the \begin{document} directive. This is necessary because the libertinus package, if used with XeLaTeX or LuaLaTeX, defers some of its setup work until the end of the preamble is reached.

enter image description here

% !TeX program = xelatex
\documentclass{article}
\usepackage{libertinus}  

\begin{document}
\renewcommand{\epsilon}{\varepsilon}

varepsilon: $\varepsilon$ \quad epsilon: $\epsilon$
\end{document}
1
  • thanks this works perfectly
    – Evan Tseng
    Jun 6 at 5:35
7

Since libertinus-otf uses unicode-math, you need to delay the setting.

\documentclass{article}
\usepackage{libertinus}

\AtBeginDocument{\renewcommand{\epsilon}{\varepsilon}}

\begin{document}

This is \texttt{varepsilon}: $\varepsilon$.

This is \texttt{epsilon}, which should be looked the same as 
\texttt{varepsilon} $\epsilon$.

\end{document}

enter image description here

1
  • I think this is preferable because it keeps setup in the preamble.
    – A. R.
    Jun 6 at 15:26

You must log in to answer this question.

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