0

I am looking to input greek characters directly in the tex file. I could do this with pdflatex, but I cannot find a way to do this in lualatex. I really don't want to type \greek{greeksymbol} for every greek symbol that I have to insert, since some of my references will also have greek symbols, and I will have to go and change all of those as well.

MWE of my current solution

\documentclass[12pt]{report}

\usepackage{fontspec} % lualatex only \usepackage{unicode-math} % lualatex only \usepackage[american,greek]{babel} \setmathfont{Latin Modern Math} \newcommand{\greek}[1]{$\mathbfup{#1}$}

\begin{document}

Protein secondary structure includes \greek{α}-helices and \greek{β}-sheets.

\end{document}

which outputs thisenter image description here

where as in an ideal world all I would have to type is

% whatever packages are needed to accomplish this
\begin{document}

Protein secondary structure includes α-helices and β-sheets.

\end{document}

and it would display the same thing. Does anyone have any solutions? It needs to be within lualatex because I am using OTF fonts.

EDIT:

So here is a MWE where I can type it.

\documentclass[12pt]{report}

\usepackage{fontspec} % lualatex only \usepackage{unicode-math} % lualatex only \usepackage[american,greek]{babel} \babelprovide[import=el, onchar=ids fonts]{greek} \babelfont{rm}[Language=Default]{Latin Modern Math}

\begin{document}

Protein secondary structure includes α-helices and β-sheets.

\end{document}

Awesome. Is there a way for it to be automatically boldended? I would like to have all greek symbols in bold.

jfang5
  • 49
  • 1
    You should take a look at this question: LuaLaTeX invisible unicode characters – Enevevet Aug 19 '21 at 00:04
  • I thought there would be a way to do this without changing my font, since that requires \setmainfont{Stix Two Math} while I really would like to keep using lmr for my main font. I don't know why this is so difficult on lualatex, but on pdflatex this was really straight forward. – jfang5 Aug 19 '21 at 00:16
  • 1
    @jfang5 There were two answers to the question Enevevet linked, one of them shows how to integrate Greek without changing the main font. – Marcel Krüger Aug 19 '21 at 01:07
  • Ah I see. Is there a way to then for it to automatically be boldened? \textbf{greeksymbol} didn't seem to have an effect, while my MWE obviously does. – jfang5 Aug 19 '21 at 01:27
  • why did you change the text font to latin modern math? Math fonts typically don't have a bold version. Use a proper text font with greek symbols, e.g. \usepackage{newcomputermodern} should work. – Ulrike Fischer Aug 19 '21 at 09:13

1 Answers1

1

A simple solution

\documentclass[12pt]{report} 
\usepackage{fontsetup}
\begin{document}
    Protein secondary structure includes α-helices and β-sheets. \par
    Protein secondary structure includes \textbf{α}-helices and \textbf{β}-sheets.
\end{document}

enter image description here

polyn
  • 5,614
  • This is what I was looking for. I saw this a while ago but I mistook fontsetup for fontspec, and I thought there was a way to do it with fontspec. Thanks! – jfang5 Aug 19 '21 at 21:09