\documentclass{article}
\usepackage{cmap} % fix search and cut-and-paste in Acrobat Reader

\usepackage%
{lmodern}
% {gfsartemisia}
% {gfsbaskerville}
% [default]{gfsbodoni}
% [default]{gfscomplutum}
% {gfsdidot}
% [default]{gfsneohellenic}
% {lmodern} \usepackage{gfsporson} \renewcommand*\rmdefault{porson}
% [default]{gfssolomos}
% {kerkis} % lacks some chars (\Stigma, \Sampi, double quotesv)
% {teubner}
\renewcommand{\ttdefault}{txtt}


\usepackage{parskip}
\usepackage{textcomp}
\usepackage[LGRx,T1]{fontenc} % LGR with accent definitions
% \usepackage[utf8]{inputenc}

\newcommand{\LGR}{\fontencoding{LGR}\selectfont}
\newcommand{\Latin}{\fontencoding{T1}\selectfont}

% \pagestyle{empty}
% -------------------------------------------------------------------------

\begin{document}

\section*{Test the extended LGR font encoding definitions}

The file lgrxenc.def allows convenient typesetting of Greek letters
with diacritics. It works independent of the babel package.

\subsection*{Symbols}

See the source file lgrenc-test.tex for the macros used to produce the
symbols.

\subsubsection*{Generic text symbols}

Latin:
+ - = < > -- --- \textbraceleft{} [ () ] \textbraceright{}
%
\textbackslash{}
\textbar{}
\textperthousand{}
\textpertenthousand{}
\textvisiblespace{}

LGR:
\LGR
+ - = \textless{} \textgreater{} -- ---
\textbraceleft{} [ () ] \textbraceright{}
%
\textbackslash{} \textbar{}
\textperthousand{}
% \textpertenthousand{}
\textvisiblespace{}
\Latin (Per-mille symbol is missign in LGR.)

Quotes:
%
\Latin \guillemotleft{}a\guillemotright{}
\LGR \guillemotleft{}a\guillemotright{},
%
\Latin \textquoteleft{}a\textquoteright{}
\LGR \textquoteleft{}a\textquoteright{},
%
\Latin \textquotedblleft{}a\textquotedblright{}
\LGR \textquotedblleft{}a\textquotedblright{}
\Latin (double quotes wrong with Kerkis fonts),

\Latin \guilsinglleft{}a\guilsinglright{}
       \quotedblbase{}a\textquotedblright{}
Single guillemots and base-quotes are missing in LGR.


Ligature break up: AY fi \LGR AU "i $\mapsto$
\Latin A\textcompwordmark{}Y f\textcompwordmark i
\LGR   A\textcompwordmark{}U "\textcompwordmark i


\Latin Spacing accent chars:
%
\Latin \textasciicircum a
\LGR \textasciicircum a \textasciicircum i % using textsym glyph
%
\Latin \textasciitilde a
\LGR \textasciitilde a \textasciitilde i
%
\Latin \textasciibreve a
\LGR \textasciibreve a \textasciibreve i
%
\Latin \textasciimacron a
\LGR \textasciimacron a \textasciimacron i
%
\Latin \textasciidieresis a
\LGR \textasciidieresis a \textasciidieresis i
%
\Latin \textasciiacute a
\LGR \textasciiacute a \textasciiacute i
%
\Latin \textasciigrave a
\LGR \textasciigrave a \textasciigrave i

\Latin Symbols for SI-units:
\Latin 5\,\textmu{}m, 5\,k\textohm{};
\LGR   5\,\textmu{}{\Latin m}, 5\,{\Latin k}\textohm{}

\Latin Letter schwa and Euro symbol: % \textschwa (needs e.g. T3)
\LGR \textschwa{}, \texteuro{}


\Latin Some symbol definitions expect a Latin font:
%
\textcopyright{}
\textregistered{}
\texttrademark{}
\SS{} (uppercase of \ss)
% $\Longrightarrow$
% \LGR
% \textcopyright{}
% \textregistered{}
% \texttrademark{}
% \ss$\mapsto$\SS{}
%
\Latin Babel's lgrenc.def defines them with \verb|\latintext|, however this
macro is not guaranteed to be defined, so it should not be used in a font
encoding definition file. Instead, the textcomp.sty package should be used
to provide the symbols for all font encodings (the sharp s (\ss) is used in
German text that cannot be set with LGR anyway).

\subsubsection*{Greek alphabet}

Greek letters via Latin transscription in LGR font encoding:

\LGR
\MakeUppercase{a b g d e z h j i k l m n x o p r s t u f q y w}

a b g d e z h j i k l m n x o p r s c t u f q y w

\Latin

\subsubsection*{Additional Greek symbols}

\LGR \koppa{}     \Latin koppa,         % ÏŸ
\LGR \qoppa{}     \Latin archaic koppa, % Ï™
\LGR \Qoppa{}     \Latin archaic Koppa, % Ϙ
\LGR \stigma{}    \Latin stigma,        % Ï›
\LGR \varstigma{} \Latin stigma variant,
\LGR \Stigma{}    \Latin Stigma (Sigma-Tau-Ligature in CB-fonts),
\LGR \sampi{}     \Latin sampi,         % Ï¡
\LGR \Sampi{}     \Latin Sampi,         % Ï 
\LGR \ddigamma{}  \Latin digamma,       % ϝ (\digamma used by amsmath!)
\LGR \Digamma{}   \Latin Digamma,       % Ϝ
% numeral signs: http://en.wikipedia.org/wiki/Greek_numerals
\LGR \anwtonos{}  \Latin Dexia keraia,  % Í´
\LGR \katwtonos{} \Latin Aristeri keraia, % ͵

\Latin Variant symbols for pi ($\varpi$), kappa (\emph{no TeX symbol
available}), rho ($\varrho$), and theta ($\vartheta$) are missing in
LGR.


\subsection*{Diacritics}

Capital Greek letters have Greek diacritics (except the dialytika) to the
left (instead of above) and drop them in UPPERCASE. This is
implemented for all combinations for which a precomposed Unicode
character exists (but not, e.g., \LGR \~A\Latin).

% When a word is written entirely in capital letters, diacritics are
% never used; the word Ἢ (or), is an exception to this rule because of
% the need to distinguish it from the nominative feminine article Η.

LaTeX standard accents (Latin, Greek, Greek Capitals)
$\mapsto$ UPPERCASE

\`{a} \'{a} \~{a} \"{a} \^{a} \={a} \H{a} \.{a} \r{a} \u{a} \v{a}
\b{a} \c{a} \d{a} \k{a}
$\mapsto$ \MakeUppercase{%
\`{a} \'{a} \~{a} \"{a} \^{a} \={a} \H{a} \.{a} \r{a} \u{a} \v{a}
\b{a} \c{a} \d{a} \k{a}
}

\LGR
\`{a} \'{a} \~{a} \"{a} \^{a} \={a} \H{a} \.{a} \r{a} \u{a} \v{a}
\b{a} \c{a} \d{a}
$\mapsto$ \MakeUppercase{%
\`{a} \'{a} \~{a} \"{a} \^{a} \={a} \H{a} \.{a} \r{a} \u{a} \v{a}
\b{a} \c{a} \d{a}
}

\`{A} \'{A} \~{A} \"{A} \^{A} \={A} \H{A} \.{A} \r{A} \u{A} \v{A}
\b{A} \c{A} \d{A}
$\mapsto$ \MakeUppercase{%
\`{A} \'{A} \~{A} \"{A} \^{A} \={A} \H{A} \.{A} \r{A} \u{A} \v{A}
\b{A} \c{A} \d{A}
}

\Latin
The komma-below (\verb|\k|) is not defined in LGR.

Additional Greek diacritics\footnote{%
The dialytika is not used on Initial letters, therfore the combined
``something + dialytika'' accents are not moved befor the capital Iota.}

\LGR
\<{a} \>{e} \<\`{i} \'"i \`"i \~"i \`\>{h} \'<{o}  \'>{o} \~\<{u} \~\>{w}
$\mapsto$ \MakeUppercase{%
\<{a} \>{e} \<\`{i} \'"i \`"i \~"i \`\>{h} \'<{o}  \'>{o} \~\<{u} \~\>{w}
}

\<{A} \>{E} \<\`{I} \'"I \"`I \~"I \`\>{H} \'<{O}  \'>{O} \~\<{U} \~\>{W}
$\mapsto$ \MakeUppercase{%
\<{A} \>{E} \<\`{I} \'"I \"`I \~"I \`\>{H} \'<{O}  \'>{O} \~\<{U} \~\>{W}
}

\Latin Input variants and their conversion with MakeUppercase:%

\begin{quote} \LGR
\~>a \>\~a \~\>{a}, \~<a \<\~a \<~a \~\<a \~<a,
\>\~{h} \~>h \>~h \>\~h \~>h \~>h|, \~<h \<\~h,
\>\~i \~>i, \~<i \<\~i, \~"i \"\~i \"~i,\\
\>\~u \~>u, \~<u \<\~u, \~"u \"\~u,
\>w, \<w, \>\~w \~>w, \~<w \<\~w.

\MakeUppercase{
\~>a \>\~a \~\>{a}, \~<a \<\~a \<~a \~\<a \~<a,
\>\~{h} \~>h \>~h \>\~h \~>h \~>h|, \~<h \<\~h,
\>\~i \~>i, \~<i \<\~i, \~"i \"\~i \"~i,\\
\>\~u \~>u, \~<u \<\~u, \~"u \"\~u,
\>w, \<w, \>\~w \~>w, \~<w \<\~w.
}

\<'A \<\'A \'<A \'\<A $\mapsto$ \MakeUppercase{\<'A \<\'A \'<A \'\<A}.
\end{quote}

\Latin The tilde character can be used in combined accents.
However, in documents not defining the Babel language \emph{greek} or
\emph{polutonikogreek}, it will produce a
no-break space if converted with \verb|\MakeUppercase|:

\LGR \"~i \<~i \"~u \<~u \`>u $\mapsto$
\LGR \MakeUppercase{\"~i \<~i \"~u \<~u \`>u}
\\
\Latin Use the tilde-accent macro:
\LGR \MakeUppercase{\"\~i \~"u}.

\Latin Combinations with named accents:
\LGR \accdasia'a \accdasia`a \accdasia\~a.

\Latin The dialytika must be kept in UPPERCASE, e.\,g.

% from http://diacritics.typo.cz/index.php?id=70 μαΐστρος -> ΜΑΪΣΤΡΟΣ.
\LGR ma\"'istros $\mapsto$ \MakeUppercase{ma\"'istros}
\Latin or % from teubner  εὐζωΐα -> ΕΥΖΩΪΑ.
\LGR e\>uzw\'"ia $\mapsto$ \MakeUppercase{e\>uzw\'"ia}.

\Latin This is implemented for all input variants of diacritics with
dialytika:

\LGR \"i \"'i \"`i \"\~i \"u \"'u \"`u \"\~u $\mapsto$
\MakeUppercase{\"i \"'i \"`i \"\~i \"u \"'u \"`u \"\~u},

\Latin Tonos and dasia mark a \emph{hiatus} (break-up of a diphtong) if
placed on the first vowel of a diphtong ({\LGR \'ai, \'au, \'ei}). A
dialytika must be placed on the second vowel if they are dropped: \LGR
(\MakeUppercase{\'ai, \'au, \'ei}).

% from teubner: άυλος/ΑΫΛΟΣ
\'aulos $\mapsto$ \MakeUppercase{\'aulos},
\>'aulos $\mapsto$ \MakeUppercase{\>'aulos},
% from http://diacritics.typo.cz/index.php?id=69  μάινα -> ΜΑΪΝΑ
m\'aina $\mapsto$ \MakeUppercase{m\'aina},
% from  http://de.wikipedia.org/wiki/Neugriechische_Orthographie#Das_Trema
% κέικ, ἀυπνία/αϋπνία
k\'eik, $\mapsto$ \MakeUppercase{k\'eik}
\>aupn\'ia $\mapsto$ \MakeUppercase{\>aupn\'ia}


\Latin Test: The auto-hiatus feature must keep proper working of tonos
and psili:

\LGR \MakeUppercase{\'a b}: \Latin keep space after A.

\LGR
\newcommand\md{\textcompwordmark}
\newcommand\MU{\MakeUppercase}

  \md \MU{ AO    AY    AI    AU    RA    OA    UA    DU}    [ \\
\<\md \MU{ \<AO  \<AY  \<AI  \<AU  \<RA  \<OA  U\<A  D\<U}  [ \\
\>\md \MU{ \>AO  \>AY  \>AI  \>AU  \>RA  \>OA  U\>A  D\>U}  [ \\
\>'\md\MU{ \>'AO \>'AY \>'AI \>'AU \>'RA \>'OA U\>'A D\>'U} [ \\
\'\md \MU{ \'AO  \'AY  \'AI  \'AU  \'RA  \'OA  U\'A  D\'U}  [ \\
\>`\md\MU{ \>`AO \>`AY \>`AI \>`AU \>`RA \>`OA U\>`A D\>`U} [ \\
\<'\md\MU{ \<'AO \<'AY \<'AI \<'AU \<'RA \<'OA U\<'A D\<'U} [ \\
\`\md \MU{ \`AO  \`AY  \`AI  \`AU  \`RA  \`OA  U\`A  D\`U}  [ \\
\<`\md\MU{ \<`AO \<`AY \<`AI \<`AU \<`RA \<`OA U\<`A D\<`U} [ \\
\~\md \MU{ \~AO  \~AY  \~AI  \~AU  \~RA  \~OA  U\~A  D\~U}  [ \\
\~>\md\MU{ \~>AO \~>AY \~>AI \~>AU \~>RA \~>OA U\~>A D\~>U} [ \\
\~<\md\MU{ \~<AO \~<AY \~<AI \~<AU \~<RA \~<OA U\~<A D\~<U} [ \\
\~<\md\MU{ \~<ao \~<ay \~<ai \~<au \~<ra \~<oa u\~<a d\~<u} [ \\
\"\md \MU{ AO    AY    A\"I  A\"U  RA    OA    \"UA  DU}    [ \\
\"\md \MU{ \"AO  \"AY  \"AI  \"AU  \"RA  \"OA  U\"A  D\"U}  [ \\
\"~\md\MU{ \~"AO \~"AY \~"AI \~"AU \~"RA \~"OA U\~"A D\~"U} [ \\


\Latin 
rows 3\ldots 7: Lookahead (to check for a hiatus) breaks kerning before A
with tonos or psili.

% \'AA \'AB \'AG \'AD \'AE \'AZ \'AH \'AJ \'AI \'AK \'AL \'AM \'AN \'AX
% \'AO \'AP \'AR \'AS \'AC \'AT \'AU \'AF \'AQ \'AY \'AW

rows 15 and 16: Like in any font encoding, there is no kerning for
non-defined accent-letter-combinations (dialytica on \LGR A O D\Latin).

The uppercase of the zero-width space at the place of ``v`` is the
Dasia-Oxia accent~\LGR \MakeUppercase{v}\Latin , the glyph at the
position of ``V``. It is suppressed for uppercased accents:

\LGR
\<v, \>v, \>'v, \'v, \>`v, \<'v, \`v, \<`v, \~v, \~>v, \~<v, \"v, \~"v
$\mapsto$ \MakeUppercase{
\<v, \>v, \>'v, \'v, \>`v, \<'v, \`v, \<`v, \~v, \~>v, \~<v, \"v, \~"v
}

\Latin

Downcasing should keep diacritics (of course, it cannot regenerate
``manually" dropped ones):
\LGR 'A \"I \"U \~"A $\mapsto$ \MakeLowercase{\'A \"I \"U \~"A}

\end{document}