[Tex/LaTex] How to use both English and Greek (Tex Live & pdflatex) and even Hebrew easily in one document

englishgreekhebrew

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?

Best Answer

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}
Related Question