diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/greek-fontenc/lgr2licr.lua.html')
-rw-r--r-- | Master/texmf-dist/doc/latex/greek-fontenc/lgr2licr.lua.html | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/greek-fontenc/lgr2licr.lua.html b/Master/texmf-dist/doc/latex/greek-fontenc/lgr2licr.lua.html new file mode 100644 index 00000000000..7762506cab8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/greek-fontenc/lgr2licr.lua.html @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta name="generator" content="Docutils 0.11: http://docutils.sourceforge.net/" /> +<title>LGR Transcription to Greek LICR transformation</title> +<meta name="copyright" content="© 2010 Günter Milde" /> +<link rel="stylesheet" href="../../../../../Python/docutils-svn/docutils/docutils/writers/html4strict/html4css1.css" type="text/css" /> +<link rel="stylesheet" href="../../../../../Python/docutils-svn/docutils/docutils/writers/html4strict/html4css2.css" type="text/css" /> +</head> +<body> +<div class="document" id="lgr-transcription-to-greek-licr-transformation"> +<h1 class="title">LGR Transcription to Greek LICR transformation</h1> + +<dl class="docinfo simple"> +<dt class="copyright">Copyright</dt> +<dd class="copyright">© 2010 Günter Milde</dd> +<dt>Licence</dt> +<dd><p>This work may be distributed and/or modified under the +conditions of the <a class="reference external" href="http://www.latex-project.org/lppl.txt">LaTeX Project Public License</a>, either +version 1.3 of this license or any later version.</p> +</dd> +</dl> +<!-- #!/usr/bin/env lua +- - -*- coding: utf-8 -*- --> +<p>The LGR font encoding is the de-facto standard for Greek typesetting with +LaTeX. This file provides a translation from the Latin transcription defined +by LGR into the LaTeX Internal Character Representation (LICR) macros.</p> +<pre class="literal-block">usage = [[ +Usage: lua lgr2licr.lua [OPTIONS] [STRING] + Convert STRING from Latin transcription to LICR macros for Greek symbols. + Without argument, the script reads from standard input, e.g., a + redirected file or interactive input ended with Ctrl-D. +Options: -h, --help show this help +]] + +if arg[1] == "-h" or arg[1] == "--help" then + print(usage) + return +end +</pre> +<p>Get input string:</p> +<pre class="literal-block">if ... then + s = string.gsub(..., "\t", " ") +else + s = io.read("*all") +end +</pre> +<p>The mapping from the LGR Latin transcription to LICR macros:</p> +<pre class="literal-block">LGR_map = { + A = "\\textAlpha{}", + B = "\\textBeta{}", + G = "\\textGamma{}", + D = "\\textDelta{}", + E = "\\textEpsilon{}", + Z = "\\textZeta{}", + H = "\\textEta{}", + J = "\\textTheta{}", + I = "\\textIota{}", + K = "\\textKappa{}", + L = "\\textLambda{}", + M = "\\textMu{}", + N = "\\textNu{}", + K = "\\textXi{}", + O = "\\textOmicron{}", + P = "\\textPi{}", + R = "\\textRho{}", + S = "\\textSigma{}", + T = "\\textTau{}", + U = "\\textUpsilon{}", + F = "\\textPhi{}", + Q = "\\textChi{}", + Y = "\\textPsi{}", + W = "\\textOmega{}", + + a = "\\textalpha{}", + b = "\\textbeta{}", + g = "\\textgamma{}", + d = "\\textdelta{}", + e = "\\textepsilon{}", + z = "\\textzeta{}", + h = "\\texteta{}", + j = "\\texttheta{}", + i = "\\textiota{}", + k = "\\textkappa{}", + l = "\\textlambda{}", + m = "\\textmu{}", + n = "\\textnu{}", + x = "\\textxi{}", + o = "\\textomicron{}", + p = "\\textpi{}", + r = "\\textrho{}", + s = "\\textautosigma{}", + c = "\\textfinalsigma{}", + t = "\\texttau{}", + u = "\\textupsilon{}", + f = "\\textphi{}", + q = "\\textchi{}", + y = "\\textpsi{}", + w = "\\textomega{}", + v = "\\noboundary{}", + + ["'"] = "\\'", + ["`"] = "\\`", + ["~"] = "\\~", + ["<"] = "\\<", + [">"] = "\\>", + ["|"] = "\\|", + ['"'] = '\\"', + [";"] = "\\textanoteleia{}", + ["?"] = "\\texterotimatiko{}", +} +</pre> +<p>Replace the “autosigma” (s) with “sigma” (sv) if followed by another +character and with “finalsigma” (c) if followed by space or punctuation:</p> +<pre class="literal-block">s = string.gsub(s, "s([a-z'`~<>])", "sv%1") +s = string.gsub(s, "s([ ,.:;?!])", "c%1") +s = string.gsub(s, 's"(%s)', 'c"%1') -- " before whitespace is quote/apostrophe +</pre> +<p>Use the mapping to replace every ASCII-character with +non-standard meaning to the corresponding LICR macro:</p> +<pre class="literal-block">s = string.gsub(s, "([a-zA-Z'`~<>|\";?])", LGR_map) +</pre> +<p>Some cleanup operations:</p> +<pre class="literal-block">s = string.gsub(s, "\\'\\'", "\\textquoteright{}") -- '' +s = string.gsub(s, "\\`\\`", "\\textquoteleft{}") -- `` +s = string.gsub(s, "\\textautosigma{}\\noboundary{}", "\\textsigma{}") -- sv +s = string.gsub(s, "{}\\", "\\") +</pre> +<p>The quotation mark (“) denotes a quote/apostrophe if followed by a space:</p> +<pre class="literal-block">s = string.gsub(s, '\"(%s)', "\\textquoteright{}%1") +</pre> +<p>Write the result to stdout:</p> +<pre class="literal-block">io.write(s) +</pre> +</div> +</body> +</html> |