2

I want to write the document in English, and copy-paste some text from online sources, where unicode symbols are usually used, for example:

$\frac{dω(τ)}{dτ}$

The letter tau is compilable in many places for example here, but not compliable on pdfLaTeX on Overleaf.

Is it possible to add a package to make things work?

2
  • 4
    overleaf is just hosting a standard texlive Greek letters would be defined by default if you use lualatex or xslatex and unicode-math. but not otherwise. If they are defined "here" by which I assume you mean a local tex installation on your machine, the same definitions will work at overleaf, but you have not shown any example code Dec 3, 2023 at 12:49
  • 2
    for pdflatex you could for example add \DeclareUnicodeCharacter{03C4}{\tau} but show the definitions you are usiing on the document that you have that works. Dec 3, 2023 at 12:51

3 Answers 3

3

If you want to (or must) stay with pdflatex, the package "alphabeta" (part of greek-fontenc) may help you:

\documentclass[]{article}
\usepackage{alphabeta}
\begin{document}
$\frac{dω(τ)}{dτ}$
\end{document}

Mind, that "alphabeta" and "unicode-math" are incompatible (the latter is to be preferred with Xe/LuaTeX).

1
  • Many thanks! I'll try it out
    – dodo
    Dec 4, 2023 at 19:08
3

In OpTeX, the Unicode Math is initialized when appropriate font family is selected by \fontfam. You needn't do more than:

\fontfam[lm]
$dω(τ)\over dτ$
\bye
2

Is it possible to add a package to make things work?

Such a package exists. Its name is unicode-math, and it's been around for several years already.

Observe that it's necessary to use either LuaLaTeX or XeLaTeX to process a document that loads the unicode-math package. To employ LuaLaTeX or XeLaTeX in Overleaf, I suggest you proceed as follows: In an Overleaf project, begin by opening the "Menu" drop-down list. Then, under the "Settings" header, open the "Compiler" box. The default compiler is pdfLaTeX; choose either LuaLaTeX or XeLaTeX and proceed from there.

enter image description here

%% compile with either LuaLaTeX or XeLaTeX
\documentclass{article}
\usepackage{unicode-math}
\begin{document}
$\frac{dω(τ)}{dτ}$
\end{document}
4
  • Dear Mico, I changed to XeLatex, and I reloaded the page. However, it gives an error when compiling: "Package hyperref Error: Wrong driver option `pdftex',"
    – dodo
    Dec 3, 2023 at 13:50
  • 1
    @dodo You seem to have \usepackage[...,pdftex,...]{hyperref}. Remove the wrong option. By the way, the pdftex option should never be used.
    – egreg
    Dec 3, 2023 at 13:51
  • I do have \documentclass[pdftex .....
    – dodo
    Dec 3, 2023 at 13:53
  • @dodo - Yes, by all means, do please omit the pdftex option.
    – Mico
    Dec 3, 2023 at 14:07

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