public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: BP Jonsson <bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Ancient Greek in output PDF
Date: Wed, 25 Jan 2017 18:46:56 +0100	[thread overview]
Message-ID: <920a0f68-a164-53aa-b3bb-224307772512@gmail.com> (raw)
In-Reply-To: <631d8a2d-12a0-4dbd-ad98-6988e9db6d54-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

Please excuse me for not noticing this thread until now!

Den 2017-01-24 kl. 20:15, skrev John Muccigrosso:
> 
> On Tuesday, January 24, 2017 at 12:35:08 PM UTC-5, ousia wrote:
>>
>> Even defining a fallaback font for Greek characters should be easy with 
>> fontspec. But I haven’t used LaTeX for years and I don’t remember how to 
>> do it. 
>>
>>
> A quick look at the font spec docs didn't help me much. I think ideally I'd 
> like to be able to use something like \setgreekfont{blah} and have it use 
> that font whenever there's some continuous text using the Greek section of 
> Unicode.
> 
> That might be too much to ask though. 

In fact you can, at least assuming that you use XeLaTeX, which is a good idea anyway.  
The easiest way would be to include the necessary LaTeX commands in the document metadata:

```
---
header-includes:
    # Hide command with non-standard arg structure so pandoc doesn't mess it up!
  - \newcommand{\NoPandoc}[1]{#1}
  - \NoPandoc{\newfontfamily\greekfont{GFS Didot}[Script=Greek,Scale=MatchLowercase]}
...

## Tetrapharmacus

| Don't fear god,
| Don't worry about death;
| What is good is easy to get,
| What is terrible is easy to endure


## [Τετραφάρμακος]{lang="grc"}

<div lang="grc">

| Ἄφοβον ὁ θεός,
| ἀνύποπτον ὁ θάνατος
| καὶ τἀγαθὸν μὲν εὔκτητον,
| τὸ δὲ δεινὸν εὐεκκαρτέρητον

</div>

```

(You said that you want the Computer/Latin Modern style, and GFS Didot <http://www.greekfontsociety.gr/typefaces/20th_21st_century#GFS_Didot> is a Greek font in Modern style which you probably will find blends well with Latin Modern. As it happens Greek Modern fonts are usually not as extremely Modern as their Latin counterparts, but who are we to argue with Firmin Didot what a Greek Modern font should look like!? :-)

Now run pandoc with `--latexengine=xelatex` and everythiing should take care of itself.

Including code for setting the Greek font in your template is also relatively straightforward. Look for the place in the default LaTeX template where the polyglossia package is loaded:


```
\else
  \usepackage{polyglossia}
  \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}
$for(polyglossia-otherlangs)$
  \setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$}
$endfor$
\fi
```

and just before the `\fi` insert the following:

```
$if(greekfont)$
  \newfontfamily\greekfont{$greekfont$}[Script=Greek,Scale=MatchLowercase]
$endif$
```

Then you can use `-V greekfont='Font Name'` on the command line or `greekfont: Font Name` in the document metadata to specify the Greek font.

Since I use several languages using different fonts in my documents I have included a more general mechanism in my LaTeX template:

```
$for(lang-fonts)$
  \newfontfamily\$lang-fonts.lang$font{$lang-fonts.font$}[$if(lang-fonts.language)$Language=$lang-fonts.language$$endif$$if(lang-fonts.script)$Script=$lang-fonts.script$$endif$$if(lang-fonts.options)$$lang-fonts.options$$else$Scale=MatchLowercase$endif$]
$endfor$
```

(BTW the `\$` in that template code may throw your editor's highlighting if you use LaTeX highlighting. The solution is to comment out that line while editing the rest of the template.)

Then in my metadata I say:

```
lang-fonts:
  - lang: greek
    font: GFS Neohellenic
    script: Greek
    language: Greek
```

The multiplication of parameters is polyglossia's and fontspec's fault. You must use their terms here unlike when loading languages where pandoc does some streamlining behind the scenes.

(I use GFS Neohellenic together with Charis SIL.  While it looks quite different it blends well. If I don't need any fancy characters in sans I usually set GFS Neohellenic as the sans font too.)

/bpj

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/920a0f68-a164-53aa-b3bb-224307772512%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


  parent reply	other threads:[~2017-01-25 17:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19 16:08 John Muccigrosso
     [not found] ` <45028ac1-86cf-40ee-b3b8-7560eb9dce47-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-01-19 19:14   ` John MacFarlane
     [not found]     ` <20170119191417.GD96884-l/d5Ua9yGnxXsXJlQylH7w@public.gmane.org>
2017-01-20  4:33       ` John Muccigrosso
     [not found]         ` <20f5af55-daf5-443c-9c5f-085b4b816ce1-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-01-20  9:04           ` John MacFarlane
2017-01-24 17:36   ` Pablo Rodríguez
     [not found]     ` <91f1b15e-860d-8b35-1451-aca9fdf4ec45-S0/GAf8tV78@public.gmane.org>
2017-01-24 18:53       ` John Muccigrosso
     [not found]         ` <67ea3fe7-0d6b-4ad2-8010-d69295cba0b8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-01-25  8:41           ` Scot Mcphee
2017-01-24 19:15       ` John Muccigrosso
     [not found]         ` <631d8a2d-12a0-4dbd-ad98-6988e9db6d54-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-01-24 19:49           ` Pablo Rodríguez
2017-01-25 17:46           ` BP Jonsson [this message]
     [not found]             ` <920a0f68-a164-53aa-b3bb-224307772512-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-26  0:50               ` John Muccigrosso
     [not found]                 ` <736ec0e9-a251-4e0c-90c6-b9e2c314532b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-01-26 13:32                   ` Melroch
2017-01-27 17:02                   ` Pablo Rodríguez
     [not found]                     ` <ec531451-39f0-109f-c64f-be594acedab1-S0/GAf8tV78@public.gmane.org>
2017-01-28 18:52                       ` John Muccigrosso
     [not found]                         ` <3177084b-b814-4bf5-859f-c74650df775a-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-01-28 19:29                           ` Andrew Dunning
     [not found]                             ` <e2f300d1-b5dd-41df-b81f-11d05516bc00-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-01-29 13:38                               ` BP Jonsson
     [not found]                                 ` <CAFC_yuQLyx_dUoMkY32OXT=-CmX9US5veLZdo87mvoD-OaUfzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-29 16:53                                   ` John Muccigrosso
2017-01-29 16:51                               ` John Muccigrosso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=920a0f68-a164-53aa-b3bb-224307772512@gmail.com \
    --to=bpjonsson-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).