2

After looking around for a while, having checked the Not-So-Short Introduction to LaTeX2e (2.5.5) and even after having found some sources on the internet, I still could not get this to work. I have been fighting with the problem for a while and it almost seems futile to continue. It must work though, as I have serious need of it. I would hope that a great relevant (and easy) answer would come that will end the issue once and for all.

English and Greek:

In a document wherein English is the main language, I wish to occasionally use Greek without resorting to commands such as $\gamma$ and $\acute{omikron}$ and the like. Even if occasional, spelling a whole word in Greek in this manner is rather time-consuming.

I normally use \usepackage[utf8]{inputenc}. I thought this would allow me to easily input Greek as easily as one would type or paste English. Then I learned one must also have a fitting font for Greek. How must one go about achieving the desired result?

English, Greek and Hebrew:

Once that is done, how does one go about adding Hebrew to it? I would want to type or paste it as easily as one would type or paste any language into a file.

Since I have lost too much time on it already, what would be the right template to have the whole matter taken care of?

Thank you.


EDIT (adding a small test file):

Below is the beginning of the file:

\documentclass[12pt, a4paper, titlepage]{article}
\usepackage[utf8]{inputenc}
\usepackage[hidelinks]{hyperref}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage[english]{babel}
\usepackage{afterpage}
\usepackage[top=1.00in, bottom=1.00in, left=1.00in, right=1.00in]{geometry}
\usepackage{setspace}

% for Greek and such
\usepackage{fontspec}
\usepackage[T1]{fontenc}
\newfontfamily\greekfont[Script=Greek, Scale=MatchUppercase, Ligatures=TeX]{linux libertine o}
\newcommand{\textgreek}[1]{\bgroup\greekfont\emph{#1}\egroup}

% fancyhdr
\usepackage{fancyhdr}
\pagestyle{fancy}

% 
\newcommand\blankpage{%
    \null
    \thispagestyle{empty}%
    \addtocounter{page}{-1}%
    \newpage}
%;

\begin{document}
\tableofcontents
\thispagestyle{empty}
\newpage

\section{Intro}
This is a word in Greek: νους.
\end{document}

I installed the font Linux Libertine O.


EDIT 2 (15-11-'16):

@Ulrike Fischer Thank you. Ever since I registered, I cannot add a comment directly under your response, so I must respond here.

I report that your first code block for use with pdflatex works, and that the second for use with xelatex or lualatex does not. When trying to compile, the earlier problem returns: it does not compile and seems to show no message or progress at all.

Regarding the first code block for use with pdflatex: if you were to enhance it to also include Hebrew, what would it look like?

  • Welcome! English & Greek is pretty straightforward - I do this not infrequently. However, Hebrew is a different matter. For Hebrew, I'd strongly recommend considering XeLaTeX as it will be much, much, much easier than pdfLaTeX. – cfr Nov 14 '16 at 16:39
  • 1
  • @musarithmia Thank you. I've tried LuaLaTex, but during compilation it takes too long. I checked and it already happens if I merely add \usepackage{fontspec}. – Jermain Nov 14 '16 at 17:38
  • @musarithmia Thanks for the effort. Still it doesn't work. Let me show partially show you the document (which looks somewhat messed up in this comment section; I don't know how to fix it): % for Greek and such \usepackage{fontspec} \usepackage[T1]{fontenc} \newfontfamily\greekfont[Script=Greek, Scale=MatchUppercase, Ligatures=TeX]{calibri} \newcommand{\textgreek}[1]{\bgroup\greekfont\emph{#1}\egroup} – Jermain Nov 14 '16 at 19:50
  • Don't load fontenc if you are using fontspec. If you use pdfLaTeX, load \usepackage[LGR,T1]{fontenc} and load babel with greek,british or greek,american. For XeLaTeX, load polyglossia and set the languages you need according to the manual. It will load fontspec etc. – cfr Nov 14 '16 at 21:22
2

Don't mix code for pdflatex with code for xelatex/lualatex

This here is for greek with pdflatex:

\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage[LGR,T1]{fontenc}
\usepackage[greek,english]{babel}

\begin{document}
This is a word in Greek: \textgreek{νους}.
\end{document}

and this with xelatex/lualatex:

\documentclass[]{article}
\usepackage{fontspec} %before babel
\usepackage[greek,english]{babel}
\setmainfont{Linux Libertine O} % a font with greek

\begin{document}
This is a word in Greek: \foreignlanguage{greek}{νους}.
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.