public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Going round in circles with latex output
@ 2017-06-06  5:52 Lyndon Drake
       [not found] ` <89122680-f883-4853-a97f-a81861395b78-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Lyndon Drake @ 2017-06-06  5:52 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2982 bytes --]

Hi all,

Many apologies as I'm sure this is all obvious once one knows, but I'm a 
bit stuck. I've got some Pandoc Markdown files which I'm trying to convert 
to PDF using Pandoc. They include various non-ascii characters, all in 
unicode. If I run:

/usr/local/bin/pandoc -f 
markdown+pipe_tables+grid_tables+yaml_metadata_block --filter 
pandoc-citeproc --filter pandoc-csv2table -s -o formatted/Draft3.pdf 
text/metadata.yaml text/1-Introduction.md

I get the following:

! Package inputenc Error: Unicode char ṣ (U+1E63)

(inputenc)                not set up for use with LaTeX.


See the inputenc package documentation for explanation.

Type  H <return>  for immediate help.

 ...                                              

                                                  

l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.}


Try running pandoc with --latex-engine=xelatex.

pandoc: Error producing PDF


So the next step was to switch to xelatex based on the helpful suggestion 
from pandoc. As long as I don't try to use any babel or polyglossia 
environments, or biblatex, this works fine. But as I want to use both, I'm 
a bit stuck. First thing is that it looks like the default template tries 
to use babel rather than polyglossia if xetex is the engine. Is there a 
reason for this? (I want to use the biblatex-sbl style for my bibliography, 
and they recommend polyglossia.)

I want to use English (UK) as my main language, with Hebrew and Syriac as 
other languages (I've also got some ancient Greek, but the main font I've 
chosen works fine and the output looks good for that without using a 
separate language environment).

As a starting point, what language options do I set in my YAML metadata to 
enable those other two language environments, and how do I specify the 
fonts for them?

Here's my YAML metadata file so far:

---
  author: Lyndon Drake
  documentclass: memoir
  toc: true
  papersize: a4
  fontsize: 12pt
  top-level-division: chapter
  number-sections: true
  mainfont: Skolar PE Light
  mainfontoptions: Numbers=OldStyle
  bibliography: /Users/lyndon/Documents/Media/Bibliography/0lib.bib
  csl: 
/Users/lyndon/Documents/Media/Bibliography/society-of-biblical-literature-fullnote-bibliography.csl
  notes-after-punctuation: true
---

Many thanks in advance for any help on this,
Lyndon

-- 
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/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 6523 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found] ` <89122680-f883-4853-a97f-a81861395b78-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-06-06  6:41   ` Melroch
       [not found]     ` <CADAJKhD0J3JG_qqs1yz5eDORPFRFJCsefUwsGq4+taYkvn95-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2017-06-07  5:43   ` iandol
  1 sibling, 1 reply; 18+ messages in thread
From: Melroch @ 2017-06-06  6:41 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 3905 bytes --]

You need  the --latex-engine=xelatex option.


tis 6 juni 2017 kl. 07:53 skrev Lyndon Drake <lyndon-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:

> Hi all,
>
> Many apologies as I'm sure this is all obvious once one knows, but I'm a
> bit stuck. I've got some Pandoc Markdown files which I'm trying to convert
> to PDF using Pandoc. They include various non-ascii characters, all in
> unicode. If I run:
>
> /usr/local/bin/pandoc -f
> markdown+pipe_tables+grid_tables+yaml_metadata_block --filter
> pandoc-citeproc --filter pandoc-csv2table -s -o formatted/Draft3.pdf
> text/metadata.yaml text/1-Introduction.md
>
> I get the following:
>
> ! Package inputenc Error: Unicode char ṣ (U+1E63)
>
> (inputenc)                not set up for use with LaTeX.
>
>
> See the inputenc package documentation for explanation.
>
> Type  H <return>  for immediate help.
>
>  ...
>
>
>
> l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.}
>
>
> Try running pandoc with --latex-engine=xelatex.
>
> pandoc: Error producing PDF
>
>
> So the next step was to switch to xelatex based on the helpful suggestion
> from pandoc. As long as I don't try to use any babel or polyglossia
> environments, or biblatex, this works fine. But as I want to use both, I'm
> a bit stuck. First thing is that it looks like the default template tries
> to use babel rather than polyglossia if xetex is the engine. Is there a
> reason for this? (I want to use the biblatex-sbl style for my bibliography,
> and they recommend polyglossia.)
>
> I want to use English (UK) as my main language, with Hebrew and Syriac as
> other languages (I've also got some ancient Greek, but the main font I've
> chosen works fine and the output looks good for that without using a
> separate language environment).
>
> As a starting point, what language options do I set in my YAML metadata to
> enable those other two language environments, and how do I specify the
> fonts for them?
>
> Here's my YAML metadata file so far:
>
> ---
>   author: Lyndon Drake
>   documentclass: memoir
>   toc: true
>   papersize: a4
>   fontsize: 12pt
>   top-level-division: chapter
>   number-sections: true
>   mainfont: Skolar PE Light
>   mainfontoptions: Numbers=OldStyle
>   bibliography: /Users/lyndon/Documents/Media/Bibliography/0lib.bib
>   csl:
> /Users/lyndon/Documents/Media/Bibliography/society-of-biblical-literature-fullnote-bibliography.csl
>   notes-after-punctuation: true
> ---
>
> Many thanks in advance for any help on this,
> Lyndon
>
> --
> 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/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CADAJKhD0J3JG_qqs1yz5eDORPFRFJCsefUwsGq4%2BtaYkvn95-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 7829 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]     ` <CADAJKhD0J3JG_qqs1yz5eDORPFRFJCsefUwsGq4+taYkvn95-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-06-06  7:01       ` Lyndon Drake
       [not found]         ` <99f9330e-3a82-4a0d-8bb4-4ec2513723fe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Lyndon Drake @ 2017-06-06  7:01 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 4341 bytes --]

Sorry, I probably wasn't clear: I followed the instruction from Pandoc and 
switched to xelatex. Now I'm stuck trying to configure the language options.

On Tuesday, June 6, 2017 at 7:41:32 AM UTC+1, BP wrote:
>
> You need  the --latex-engine=xelatex option.
>
>
> tis 6 juni 2017 kl. 07:53 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org 
> <javascript:>>:
>
>> Hi all,
>>
>> Many apologies as I'm sure this is all obvious once one knows, but I'm a 
>> bit stuck. I've got some Pandoc Markdown files which I'm trying to convert 
>> to PDF using Pandoc. They include various non-ascii characters, all in 
>> unicode. If I run:
>>
>> /usr/local/bin/pandoc -f 
>> markdown+pipe_tables+grid_tables+yaml_metadata_block --filter 
>> pandoc-citeproc --filter pandoc-csv2table -s -o formatted/Draft3.pdf 
>> text/metadata.yaml text/1-Introduction.md
>>
>> I get the following:
>>
>> ! Package inputenc Error: Unicode char ṣ (U+1E63)
>>
>> (inputenc)                not set up for use with LaTeX.
>>
>>
>> See the inputenc package documentation for explanation.
>>
>> Type  H <return>  for immediate help.
>>
>>  ...                                              
>>
>>                                                   
>>
>> l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.}
>>
>>
>> Try running pandoc with --latex-engine=xelatex.
>>
>> pandoc: Error producing PDF
>>
>>
>> So the next step was to switch to xelatex based on the helpful suggestion 
>> from pandoc. As long as I don't try to use any babel or polyglossia 
>> environments, or biblatex, this works fine. But as I want to use both, I'm 
>> a bit stuck. First thing is that it looks like the default template tries 
>> to use babel rather than polyglossia if xetex is the engine. Is there a 
>> reason for this? (I want to use the biblatex-sbl style for my bibliography, 
>> and they recommend polyglossia.)
>>
>> I want to use English (UK) as my main language, with Hebrew and Syriac as 
>> other languages (I've also got some ancient Greek, but the main font I've 
>> chosen works fine and the output looks good for that without using a 
>> separate language environment).
>>
>> As a starting point, what language options do I set in my YAML metadata 
>> to enable those other two language environments, and how do I specify the 
>> fonts for them?
>>
>> Here's my YAML metadata file so far:
>>
>> ---
>>   author: Lyndon Drake
>>   documentclass: memoir
>>   toc: true
>>   papersize: a4
>>   fontsize: 12pt
>>   top-level-division: chapter
>>   number-sections: true
>>   mainfont: Skolar PE Light
>>   mainfontoptions: Numbers=OldStyle
>>   bibliography: /Users/lyndon/Documents/Media/Bibliography/0lib.bib
>>   csl: 
>> /Users/lyndon/Documents/Media/Bibliography/society-of-biblical-literature-fullnote-bibliography.csl
>>   notes-after-punctuation: true
>> ---
>>
>> Many thanks in advance for any help on this,
>> Lyndon
>>
>> -- 
>> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com 
>> <https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 7956 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]         ` <99f9330e-3a82-4a0d-8bb4-4ec2513723fe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-06-06 12:08           ` BPJ
       [not found]             ` <CADAJKhAMLTJrfZG28bac8X+Sj589=vqJ18WswEax=1iEukafgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: BPJ @ 2017-06-06 12:08 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 6777 bytes --]

You need to use the lang and otherlang variables as described in the manual
http://pandoc.org/MANUAL if I recall correctly.

Alternatively/additionally write a latex file containing a preamble
fragment where you load polyglossia and any languages and fonts you need
with the options you need in the usual polyglossia/fontspec way and include
it with the -H option. You also need to mark spans/divs containing extra
languages with lang and dir attributes as appropriate. Use your browser's
page search function to find these terms in the manual.

I saw your other question about font/language switching yesterday and
started to write some documentation for the filter I use to make those
things easier. Alas I couldn't finish and today there is a national holiday
in Sweden. I'll get back to it tomorrow. Basically you can use spans with a
single short class like .g for greek and the filter will inject  latex
markup, docx custom style names or extended (html) attributes you have
declared to correspond to the class in your metadata.

I can comfort you that you are much better off than I was when I started
doing multilingual work with Pandoc. We had no filters, no native spans or
divs and no built-in multilingual/polyglossia support back then. Everything
had to be done in -H files and with raw latex in the markdown, which was a
pain because I needed to make things available in HTML as well.

I'll also update my latex template on github which contains some stuff for
fontspec font loading.

I hope this helps. I'm afraid I won't be able to check my mail for the rest
of the day.


tis 6 juni 2017 kl. 09:02 skrev Lyndon Drake <lyndon-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:

> Sorry, I probably wasn't clear: I followed the instruction from Pandoc and
> switched to xelatex. Now I'm stuck trying to configure the language options.
>
>
> On Tuesday, June 6, 2017 at 7:41:32 AM UTC+1, BP wrote:
>
>> You need  the --latex-engine=xelatex option.
>>
>> tis 6 juni 2017 kl. 07:53 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:
>>
> Hi all,
>>>
>>> Many apologies as I'm sure this is all obvious once one knows, but I'm a
>>> bit stuck. I've got some Pandoc Markdown files which I'm trying to convert
>>> to PDF using Pandoc. They include various non-ascii characters, all in
>>> unicode. If I run:
>>>
>>> /usr/local/bin/pandoc -f
>>> markdown+pipe_tables+grid_tables+yaml_metadata_block --filter
>>> pandoc-citeproc --filter pandoc-csv2table -s -o formatted/Draft3.pdf
>>> text/metadata.yaml text/1-Introduction.md
>>>
>>> I get the following:
>>>
>>> ! Package inputenc Error: Unicode char ṣ (U+1E63)
>>>
>>> (inputenc)                not set up for use with LaTeX.
>>>
>>>
>>> See the inputenc package documentation for explanation.
>>>
>>> Type  H <return>  for immediate help.
>>>
>>>  ...
>>>
>>>
>>>
>>> l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.}
>>>
>>>
>>> Try running pandoc with --latex-engine=xelatex.
>>>
>>> pandoc: Error producing PDF
>>>
>>>
>>> So the next step was to switch to xelatex based on the helpful
>>> suggestion from pandoc. As long as I don't try to use any babel or
>>> polyglossia environments, or biblatex, this works fine. But as I want to
>>> use both, I'm a bit stuck. First thing is that it looks like the default
>>> template tries to use babel rather than polyglossia if xetex is the engine.
>>> Is there a reason for this? (I want to use the biblatex-sbl style for my
>>> bibliography, and they recommend polyglossia.)
>>>
>>> I want to use English (UK) as my main language, with Hebrew and Syriac
>>> as other languages (I've also got some ancient Greek, but the main font
>>> I've chosen works fine and the output looks good for that without using a
>>> separate language environment).
>>>
>>> As a starting point, what language options do I set in my YAML metadata
>>> to enable those other two language environments, and how do I specify the
>>> fonts for them?
>>>
>>> Here's my YAML metadata file so far:
>>>
>>> ---
>>>   author: Lyndon Drake
>>>   documentclass: memoir
>>>   toc: true
>>>   papersize: a4
>>>   fontsize: 12pt
>>>   top-level-division: chapter
>>>   number-sections: true
>>>   mainfont: Skolar PE Light
>>>   mainfontoptions: Numbers=OldStyle
>>>   bibliography: /Users/lyndon/Documents/Media/Bibliography/0lib.bib
>>>   csl:
>>> /Users/lyndon/Documents/Media/Bibliography/society-of-biblical-literature-fullnote-bibliography.csl
>>>   notes-after-punctuation: true
>>> ---
>>>
>>> Many thanks in advance for any help on this,
>>> Lyndon
>>>
>>> --
>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>
>>
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CADAJKhAMLTJrfZG28bac8X%2BSj589%3DvqJ18WswEax%3D1iEukafgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 10914 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]             ` <CADAJKhAMLTJrfZG28bac8X+Sj589=vqJ18WswEax=1iEukafgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-06-06 13:26               ` Lyndon Drake
       [not found]                 ` <e028cdb2-2ace-4a13-8a13-3c2858f002b1-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Lyndon Drake @ 2017-06-06 13:26 UTC (permalink / raw)
  To: pandoc-discuss; +Cc: bpj-J3H7GcXPSITLoDKTGw+V6w


[-- Attachment #1.1: Type: text/plain, Size: 8843 bytes --]

Thanks for this. I'd come to the conclusion that writing a latex file and 
including the fragments that pandoc generates might be the way forward, but 
I'm also curious to know what I've been doing wrong.

No rush of course, but I'm keen to have a look at your filter and see what 
it does, even without docs. I've also found another filter on the list back 
in 2014 from Jesse Rosenthal that looks at Unicode ranges and wraps them in 
a latex environment, which seems like a good idea (I've done this kind of 
thing in InDesign grep styles and it works well for most normal bits of 
text).

I found the lang/otherlangs documentation, but couldn't figure out from the 
manual (might just be overlooking the correct bit) how to set a div or a 
span for another language.

Part of the problem is that if I set lang and otherlangs as follows:

  lang: en-GB
  otherlangs: [he, sy]
  
I get this:

! Package bidi Error: Oops! you have loaded package longtable after bidi 
packag

e. Please load package longtable before bidi package, and then try to run 
xelat

ex on your document again.


See the bidi package documentation for explanation.

Type  H <return>  for immediate help.

 ...                                              

                                                  

l.72 \begin{document}


pandoc: Error producing PDF


which I guess means that some kind of strange interaction in the latex 
template is producing an undesirable latex file to feed to xelatex (maybe 
pandoc-csv2table is doing something to the produced latex?). But it kind of 
put a stop to me experimenting with the spans and divs.

Best,
Lyndon

On Tuesday, June 6, 2017 at 1:08:48 PM UTC+1, BPJ wrote:
>
> You need to use the lang and otherlang variables as described in the 
> manual http://pandoc.org/MANUAL if I recall correctly.
>
> Alternatively/additionally write a latex file containing a preamble 
> fragment where you load polyglossia and any languages and fonts you need 
> with the options you need in the usual polyglossia/fontspec way and include 
> it with the -H option. You also need to mark spans/divs containing extra 
> languages with lang and dir attributes as appropriate. Use your browser's 
> page search function to find these terms in the manual.
>
> I saw your other question about font/language switching yesterday and 
> started to write some documentation for the filter I use to make those 
> things easier. Alas I couldn't finish and today there is a national holiday 
> in Sweden. I'll get back to it tomorrow. Basically you can use spans with a 
> single short class like .g for greek and the filter will inject  latex 
> markup, docx custom style names or extended (html) attributes you have 
> declared to correspond to the class in your metadata.
>
> I can comfort you that you are much better off than I was when I started 
> doing multilingual work with Pandoc. We had no filters, no native spans or 
> divs and no built-in multilingual/polyglossia support back then. Everything 
> had to be done in -H files and with raw latex in the markdown, which was a 
> pain because I needed to make things available in HTML as well.
>
> I'll also update my latex template on github which contains some stuff for 
> fontspec font loading.
>
> I hope this helps. I'm afraid I won't be able to check my mail for the 
> rest of the day.
>
>
> tis 6 juni 2017 kl. 09:02 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org 
> <javascript:>>:
>
>> Sorry, I probably wasn't clear: I followed the instruction from Pandoc 
>> and switched to xelatex. Now I'm stuck trying to configure the language 
>> options.
>>
>>
>> On Tuesday, June 6, 2017 at 7:41:32 AM UTC+1, BP wrote:
>>
>>> You need  the --latex-engine=xelatex option.
>>>
>>> tis 6 juni 2017 kl. 07:53 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:
>>>
>> Hi all,
>>>>
>>>> Many apologies as I'm sure this is all obvious once one knows, but I'm 
>>>> a bit stuck. I've got some Pandoc Markdown files which I'm trying to 
>>>> convert to PDF using Pandoc. They include various non-ascii characters, all 
>>>> in unicode. If I run:
>>>>
>>>> /usr/local/bin/pandoc -f 
>>>> markdown+pipe_tables+grid_tables+yaml_metadata_block --filter 
>>>> pandoc-citeproc --filter pandoc-csv2table -s -o formatted/Draft3.pdf 
>>>> text/metadata.yaml text/1-Introduction.md
>>>>
>>>> I get the following:
>>>>
>>>> ! Package inputenc Error: Unicode char ṣ (U+1E63)
>>>>
>>>> (inputenc)                not set up for use with LaTeX.
>>>>
>>>>
>>>> See the inputenc package documentation for explanation.
>>>>
>>>> Type  H <return>  for immediate help.
>>>>
>>>>  ...                                              
>>>>
>>>>                                                   
>>>>
>>>> l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.}
>>>>
>>>>
>>>> Try running pandoc with --latex-engine=xelatex.
>>>>
>>>> pandoc: Error producing PDF
>>>>
>>>>
>>>> So the next step was to switch to xelatex based on the helpful 
>>>> suggestion from pandoc. As long as I don't try to use any babel or 
>>>> polyglossia environments, or biblatex, this works fine. But as I want to 
>>>> use both, I'm a bit stuck. First thing is that it looks like the default 
>>>> template tries to use babel rather than polyglossia if xetex is the engine. 
>>>> Is there a reason for this? (I want to use the biblatex-sbl style for my 
>>>> bibliography, and they recommend polyglossia.)
>>>>
>>>> I want to use English (UK) as my main language, with Hebrew and Syriac 
>>>> as other languages (I've also got some ancient Greek, but the main font 
>>>> I've chosen works fine and the output looks good for that without using a 
>>>> separate language environment).
>>>>
>>>> As a starting point, what language options do I set in my YAML metadata 
>>>> to enable those other two language environments, and how do I specify the 
>>>> fonts for them?
>>>>
>>>> Here's my YAML metadata file so far:
>>>>
>>>> ---
>>>>   author: Lyndon Drake
>>>>   documentclass: memoir
>>>>   toc: true
>>>>   papersize: a4
>>>>   fontsize: 12pt
>>>>   top-level-division: chapter
>>>>   number-sections: true
>>>>   mainfont: Skolar PE Light
>>>>   mainfontoptions: Numbers=OldStyle
>>>>   bibliography: /Users/lyndon/Documents/Media/Bibliography/0lib.bib
>>>>   csl: 
>>>> /Users/lyndon/Documents/Media/Bibliography/society-of-biblical-literature-fullnote-bibliography.csl
>>>>   notes-after-punctuation: true
>>>> ---
>>>>
>>>> Many thanks in advance for any help on this,
>>>> Lyndon
>>>>
>>>> -- 
>>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>>
>>>
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com 
>>>> <https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com 
>> <https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/e028cdb2-2ace-4a13-8a13-3c2858f002b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 17122 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                 ` <e028cdb2-2ace-4a13-8a13-3c2858f002b1-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-06-06 16:26                   ` Joost Kremers
       [not found]                     ` <87d1ah84m4.fsf-97jfqw80gc6171pxa8y+qA@public.gmane.org>
  2017-06-07 16:23                   ` BP Jonsson
  1 sibling, 1 reply; 18+ messages in thread
From: Joost Kremers @ 2017-06-06 16:26 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw; +Cc: bpj-J3H7GcXPSITLoDKTGw+V6w


On Tue, Jun 06 2017, Lyndon Drake wrote:
> Part of the problem is that if I set lang and otherlangs as 
> follows:
>
>   lang: en-GB
>   otherlangs: [he, sy]
>   
> I get this:
>
> ! Package bidi Error: Oops! you have loaded package longtable 
> after bidi 
> packag
>
> e. Please load package longtable before bidi package, and then 
> try to run 
> xelatex on your document again.
>
>
> which I guess means that some kind of strange interaction in the 
> latex 
> template is producing an undesirable latex file to feed to 
> xelatex (maybe 
> pandoc-csv2table is doing something to the produced latex?).

No, the template is structured in such a way that polyglossia is 
loaded before longtable, but polyglossia loads bidi in order to 
deal with RTL languages such as Syriac.

I think your best bet would be to modify the default template and 
load the other languages somewhere toward the end of the preamble, 
after longtable and any other packages are loaded. But you'll need 
to know some LaTeX and understand how Pandoc's template language 
works in order to do that.

In actual fact, though, this may be something John needs to think 
about, because the default LaTeX template obviously has a problem 
here.

HTH

-- 
Joost Kremers
Life has its moments


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                     ` <87d1ah84m4.fsf-97jfqw80gc6171pxa8y+qA@public.gmane.org>
@ 2017-06-06 20:51                       ` Lyndon Drake
       [not found]                         ` <2a8d8b0d-2740-4dfb-8718-f06432d6425f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Lyndon Drake @ 2017-06-06 20:51 UTC (permalink / raw)
  To: pandoc-discuss; +Cc: bpj-J3H7GcXPSITLoDKTGw+V6w


[-- Attachment #1.1: Type: text/plain, Size: 4433 bytes --]

I've got a fair way with this. Thanks to all for the help so far.

1. By reading through the template, I figured out which variables to define 
to control the LaTeX output. I'm seriously impressed with Pandoc's setup - 
I remember the awful pain of doing a LaTeX document from scratch and this 
gets things started so well. Thank you John & everyone else!

2. As suggested by Joost, I shifted the package load order around, 
retaining all the conditionals and variables in the template. I've now got 
something which is only different by some reordering from the default 
template, but which avoids the longtable/bidi conflict. Thanks Joost!

I've also been playing around with a couple of filters, based on code from 
Jesse Rosenthal on this list a few years back. It sort of works, but not 
well enough to rely on. For the moment, I'm just going to tag every word 
and block with div/span.

It did also occur to me that the proper place to do this stuff is actually 
in LaTeX, not Pandoc. E.g. I'm going to use biblatex, and I'd want the same 
rules applied to the output from biblatex. There's a package:

https://github.com/Pomax/ucharclasses

which does some of this. One way to do it would be to implement the Unicode 
bidi algorithm http://unicode.org/reports/tr9/ (+ some sensible font 
switching, which is actually easier than the bidi algorithm) as a LaTeX 
package, but that's a bit much for my current document. I might have a look 
at ways to do this properly in July & August though, as I'd like to have it 
available before I start my thesis.

Anyway for the moment I'm pleased that I could get this far:

https://www.dropbox.com/s/aeyvkjrox5dwtpz/Screenshot%202017-06-06%2021.37.41.png?dl=0

without having to type anything other than plain Pandoc Markdown into some 
text & csv files, and all the formatting has been done by Pandoc and some 
config. The thing that made me want to use Pandoc was the memory of my 
previous thesis (in computer science) where the markup made the document so 
cluttered I found it almost impossible to actually read the text in the 
editor. This is promising enough that I'm going to persevere to get a setup 
that will work for the upcoming thesis.

Best,
Lyndon

PS: in case it's of use to others, the relevant bits of YAML:

  header-includes:
    - \newfontfamily\hebrewfont{Taamey David CLM}
    - \newfontfamily\syriacfont{Serto Jerusalem}
  lang: en-GB
  otherlangs: [he, syr]


On Tuesday, June 6, 2017 at 5:26:21 PM UTC+1, Joost wrote:
>
>
> On Tue, Jun 06 2017, Lyndon Drake wrote: 
> > Part of the problem is that if I set lang and otherlangs as 
> > follows: 
> > 
> >   lang: en-GB 
> >   otherlangs: [he, sy] 
> >   
> > I get this: 
> > 
> > ! Package bidi Error: Oops! you have loaded package longtable 
> > after bidi 
> > packag 
> > 
> > e. Please load package longtable before bidi package, and then 
> > try to run 
> > xelatex on your document again. 
> > 
> > 
> > which I guess means that some kind of strange interaction in the 
> > latex 
> > template is producing an undesirable latex file to feed to 
> > xelatex (maybe 
> > pandoc-csv2table is doing something to the produced latex?). 
>
> No, the template is structured in such a way that polyglossia is 
> loaded before longtable, but polyglossia loads bidi in order to 
> deal with RTL languages such as Syriac. 
>
> I think your best bet would be to modify the default template and 
> load the other languages somewhere toward the end of the preamble, 
> after longtable and any other packages are loaded. But you'll need 
> to know some LaTeX and understand how Pandoc's template language 
> works in order to do that. 
>
> In actual fact, though, this may be something John needs to think 
> about, because the default LaTeX template obviously has a problem 
> here. 
>
> HTH 
>
> -- 
> Joost Kremers 
> Life has its moments 
>

-- 
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/2a8d8b0d-2740-4dfb-8718-f06432d6425f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 5593 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                         ` <2a8d8b0d-2740-4dfb-8718-f06432d6425f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-06-06 21:03                           ` Lyndon Drake
  2017-06-11  8:43                           ` John MacFarlane
  1 sibling, 0 replies; 18+ messages in thread
From: Lyndon Drake @ 2017-06-06 21:03 UTC (permalink / raw)
  To: pandoc-discuss; +Cc: bpj-J3H7GcXPSITLoDKTGw+V6w


[-- Attachment #1.1: Type: text/plain, Size: 4823 bytes --]

Here's some Syriac, generated from a CSV file with inline Markdown spans 
and emphasis:

https://www.dropbox.com/s/65s7gqghezsthfq/Screenshot%202017-06-06%2022.03.04.png?dl=0

On Tuesday, June 6, 2017 at 9:51:59 PM UTC+1, Lyndon Drake wrote:
>
> I've got a fair way with this. Thanks to all for the help so far.
>
> 1. By reading through the template, I figured out which variables to 
> define to control the LaTeX output. I'm seriously impressed with Pandoc's 
> setup - I remember the awful pain of doing a LaTeX document from scratch 
> and this gets things started so well. Thank you John & everyone else!
>
> 2. As suggested by Joost, I shifted the package load order around, 
> retaining all the conditionals and variables in the template. I've now got 
> something which is only different by some reordering from the default 
> template, but which avoids the longtable/bidi conflict. Thanks Joost!
>
> I've also been playing around with a couple of filters, based on code from 
> Jesse Rosenthal on this list a few years back. It sort of works, but not 
> well enough to rely on. For the moment, I'm just going to tag every word 
> and block with div/span.
>
> It did also occur to me that the proper place to do this stuff is actually 
> in LaTeX, not Pandoc. E.g. I'm going to use biblatex, and I'd want the same 
> rules applied to the output from biblatex. There's a package:
>
> https://github.com/Pomax/ucharclasses
>
> which does some of this. One way to do it would be to implement the 
> Unicode bidi algorithm http://unicode.org/reports/tr9/ (+ some sensible 
> font switching, which is actually easier than the bidi algorithm) as a 
> LaTeX package, but that's a bit much for my current document. I might have 
> a look at ways to do this properly in July & August though, as I'd like to 
> have it available before I start my thesis.
>
> Anyway for the moment I'm pleased that I could get this far:
>
>
> https://www.dropbox.com/s/aeyvkjrox5dwtpz/Screenshot%202017-06-06%2021.37.41.png?dl=0
>
> without having to type anything other than plain Pandoc Markdown into some 
> text & csv files, and all the formatting has been done by Pandoc and some 
> config. The thing that made me want to use Pandoc was the memory of my 
> previous thesis (in computer science) where the markup made the document so 
> cluttered I found it almost impossible to actually read the text in the 
> editor. This is promising enough that I'm going to persevere to get a setup 
> that will work for the upcoming thesis.
>
> Best,
> Lyndon
>
> PS: in case it's of use to others, the relevant bits of YAML:
>
>   header-includes:
>     - \newfontfamily\hebrewfont{Taamey David CLM}
>     - \newfontfamily\syriacfont{Serto Jerusalem}
>   lang: en-GB
>   otherlangs: [he, syr]
>
>
> On Tuesday, June 6, 2017 at 5:26:21 PM UTC+1, Joost wrote:
>>
>>
>> On Tue, Jun 06 2017, Lyndon Drake wrote: 
>> > Part of the problem is that if I set lang and otherlangs as 
>> > follows: 
>> > 
>> >   lang: en-GB 
>> >   otherlangs: [he, sy] 
>> >   
>> > I get this: 
>> > 
>> > ! Package bidi Error: Oops! you have loaded package longtable 
>> > after bidi 
>> > packag 
>> > 
>> > e. Please load package longtable before bidi package, and then 
>> > try to run 
>> > xelatex on your document again. 
>> > 
>> > 
>> > which I guess means that some kind of strange interaction in the 
>> > latex 
>> > template is producing an undesirable latex file to feed to 
>> > xelatex (maybe 
>> > pandoc-csv2table is doing something to the produced latex?). 
>>
>> No, the template is structured in such a way that polyglossia is 
>> loaded before longtable, but polyglossia loads bidi in order to 
>> deal with RTL languages such as Syriac. 
>>
>> I think your best bet would be to modify the default template and 
>> load the other languages somewhere toward the end of the preamble, 
>> after longtable and any other packages are loaded. But you'll need 
>> to know some LaTeX and understand how Pandoc's template language 
>> works in order to do that. 
>>
>> In actual fact, though, this may be something John needs to think 
>> about, because the default LaTeX template obviously has a problem 
>> here. 
>>
>> HTH 
>>
>> -- 
>> Joost Kremers 
>> Life has its moments 
>>
>

-- 
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/9eb68314-1150-42a1-bee2-5084725818a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 7608 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found] ` <89122680-f883-4853-a97f-a81861395b78-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2017-06-06  6:41   ` Melroch
@ 2017-06-07  5:43   ` iandol
       [not found]     ` <9105b544-18e3-4f40-be43-fb04c838b4de-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  1 sibling, 1 reply; 18+ messages in thread
From: iandol @ 2017-06-07  5:43 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1147 bytes --]

On Tuesday, 6 June 2017 13:52:38 UTC+8, Lyndon Drake wrote:
>
> /usr/local/bin/pandoc -f markdown+pipe_tables+grid_tables+yaml_metadata_block 
> --filter pandoc-citeproc --filter pandoc-csv2table -s -o 
> formatted/Draft3.pdf text/metadata.yaml text/1-Introduction.md
>
> ... As long as I don't try to use any babel or polyglossia environments, 
> or biblatex, this works fine. But as I want to use both, 
>

I'm confused why are you using pandoc-citeproc AND biblatex??? Shouldn't 
you use one or the other (ideally pandoc-citeproc so you reduce your latex 
dependencies). 

-- 
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/9105b544-18e3-4f40-be43-fb04c838b4de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 2006 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]     ` <9105b544-18e3-4f40-be43-fb04c838b4de-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-06-07  8:35       ` Lyndon Drake
  0 siblings, 0 replies; 18+ messages in thread
From: Lyndon Drake @ 2017-06-07  8:35 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1555 bytes --]



On Wednesday, June 7, 2017 at 6:43:23 AM UTC+1, iandol wrote:
>
> On Tuesday, 6 June 2017 13:52:38 UTC+8, Lyndon Drake wrote:
>>
>> /usr/local/bin/pandoc -f markdown+pipe_tables+grid_tables+yaml_metadata_block 
>> --filter pandoc-citeproc --filter pandoc-csv2table -s -o 
>> formatted/Draft3.pdf text/metadata.yaml text/1-Introduction.md
>>
>> ... As long as I don't try to use any babel or polyglossia environments, 
>> or biblatex, this works fine. But as I want to use both, 
>>
>
> I'm confused why are you using pandoc-citeproc AND biblatex??? Shouldn't 
> you use one or the other (ideally pandoc-citeproc so you reduce your latex 
> dependencies). 
>

That's being halfway from one to the other - pandoc-citeproc has worked 
well so far, but the sbl-latex style for biblatex has some features that 
pandoc-citeproc doesn't (to do with the citation and indexing of ancient 
sources, and the citation of lexicon and commentary sources) so I'm having 
to switch to biblatex.
 

-- 
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/c66522cd-b8b9-4e1a-807a-c7ded4812af4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 2504 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                 ` <e028cdb2-2ace-4a13-8a13-3c2858f002b1-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2017-06-06 16:26                   ` Joost Kremers
@ 2017-06-07 16:23                   ` BP Jonsson
       [not found]                     ` <ad97e931-ac10-0204-d03e-c646e32e4ba1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  1 sibling, 1 reply; 18+ messages in thread
From: BP Jonsson @ 2017-06-07 16:23 UTC (permalink / raw)
  To: Lyndon Drake, pandoc-discuss

Den 2017-06-06 kl. 15:26, skrev Lyndon Drake:
> Thanks for this. I'd come to the conclusion that writing a latex file and
> including the fragments that pandoc generates might be the way forward, but
> I'm also curious to know what I've been doing wrong.

You don't need to write the whole preamble by hand, just the part 
where you load and configure polyglossia and define the fonts 
needed for polyglossia.
put them in a file called for example `poly.ltx` and then run 
Pandoc with

````
pandoc -H poly.ltx --latex-engine=xelatex
````

I *think* this will also make the bidi bug go away. The 
polyglossia package loads the bidi package if needed, but bidi 
wants to be loaded after a lot of other packages which it performs 
keyhole surgery on, including longtable and even hyperref. However 
Pandoc's latex template, loads polyglossia quite early, 
alternatively to loading babel. There may be no other way to fix 
that than to use a custom template where polyglossia is loaded 
quite late, perhaps even after the header-includes, lest the 
latter also load some package which bidi wants to be loaded before 
itself. I have made such a template 
(<https://gist.github.com/bpj/5cebc975685134145cd74ca8670b1ccc>) 
If it solves the problem please let me know and I'll make a pull 
request for the change.

My custom template also includes my fontspec hack which lets you 
declare font families in your metadata like this:

````
font-families:
   - name: '\<language>font'
     font:    <Font Name>
     options:
       - <key>='<value>'
   - name: '\greekfont'
     font:    GFS Neohellenic
     options:
       - Language=Greek
       - Script=Greek
       - Scale=MatchLowercase
       - Ligatures=TeX
   - name: '\sanskritfont'
     font:    Sahadeva
     options:
       - Language=Sanskrit
       - Script=Devanagari
   - name: '\myfancyfont'
     font: My Fancy
````


> 
> No rush of course, but I'm keen to have a look at your filter and see what
> it does, 

It is now documented and uploaded:

<https://gist.github.com/bpj/02de1ed87ff8f8d0c31a43b9dcac1c80>

(Scroll down for the rendered documentation. The first code block 
should suffice to understand how it works.)

It takes some initial configuration but that should be reusable by 
including a separate YAML file on the command line with the actual 
document.




even without docs. I've also found another filter on the list back
> in 2014 from Jesse Rosenthal that looks at Unicode ranges and wraps them in
> a latex environment, which seems like a good idea (I've done this kind of
> thing in InDesign grep styles and it works well for most normal bits of
> text).
> 
> I found the lang/otherlangs documentation, but couldn't figure out from the
> manual (might just be overlooking the correct bit) how to set a div or a
> span for another language.
> 
> Part of the problem is that if I set lang and otherlangs as follows:
> 
>    lang: en-GB
>    otherlangs: [he, sy]
>    
> I get this:
> 
> ! Package bidi Error: Oops! you have loaded package longtable after bidi
> packag
> 
> e. Please load package longtable before bidi package, and then try to run
> xelat
> 
> ex on your document again.
> 
> 
> See the bidi package documentation for explanation.
> 
> Type  H <return>  for immediate help.
> 
>   ...
> 
>                                                    
> 
> l.72 \begin{document}
> 
> 
> pandoc: Error producing PDF
> 
> 
> which I guess means that some kind of strange interaction in the latex
> template is producing an undesirable latex file to feed to xelatex (maybe
> pandoc-csv2table is doing something to the produced latex?). But it kind of
> put a stop to me experimenting with the spans and divs.
> 
> Best,
> Lyndon
> 
> On Tuesday, June 6, 2017 at 1:08:48 PM UTC+1, BPJ wrote:
>>
>> You need to use the lang and otherlang variables as described in the
>> manual http://pandoc.org/MANUAL if I recall correctly.
>>
>> Alternatively/additionally write a latex file containing a preamble
>> fragment where you load polyglossia and any languages and fonts you need
>> with the options you need in the usual polyglossia/fontspec way and include
>> it with the -H option. You also need to mark spans/divs containing extra
>> languages with lang and dir attributes as appropriate. Use your browser's
>> page search function to find these terms in the manual.
>>
>> I saw your other question about font/language switching yesterday and
>> started to write some documentation for the filter I use to make those
>> things easier. Alas I couldn't finish and today there is a national holiday
>> in Sweden. I'll get back to it tomorrow. Basically you can use spans with a
>> single short class like .g for greek and the filter will inject  latex
>> markup, docx custom style names or extended (html) attributes you have
>> declared to correspond to the class in your metadata.
>>
>> I can comfort you that you are much better off than I was when I started
>> doing multilingual work with Pandoc. We had no filters, no native spans or
>> divs and no built-in multilingual/polyglossia support back then. Everything
>> had to be done in -H files and with raw latex in the markdown, which was a
>> pain because I needed to make things available in HTML as well.
>>
>> I'll also update my latex template on github which contains some stuff for
>> fontspec font loading.
>>
>> I hope this helps. I'm afraid I won't be able to check my mail for the
>> rest of the day.
>>
>>
>> tis 6 juni 2017 kl. 09:02 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org
>> <javascript:>>:
>>
>>> Sorry, I probably wasn't clear: I followed the instruction from Pandoc
>>> and switched to xelatex. Now I'm stuck trying to configure the language
>>> options.
>>>
>>>
>>> On Tuesday, June 6, 2017 at 7:41:32 AM UTC+1, BP wrote:
>>>
>>>> You need  the --latex-engine=xelatex option.
>>>>
>>>> tis 6 juni 2017 kl. 07:53 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:
>>>>
>>> Hi all,
>>>>>
>>>>> Many apologies as I'm sure this is all obvious once one knows, but I'm
>>>>> a bit stuck. I've got some Pandoc Markdown files which I'm trying to
>>>>> convert to PDF using Pandoc. They include various non-ascii characters, all
>>>>> in unicode. If I run:
>>>>>
>>>>> /usr/local/bin/pandoc -f
>>>>> markdown+pipe_tables+grid_tables+yaml_metadata_block --filter
>>>>> pandoc-citeproc --filter pandoc-csv2table -s -o formatted/Draft3.pdf
>>>>> text/metadata.yaml text/1-Introduction.md
>>>>>
>>>>> I get the following:
>>>>>
>>>>> ! Package inputenc Error: Unicode char ṣ (U+1E63)
>>>>>
>>>>> (inputenc)                not set up for use with LaTeX.
>>>>>
>>>>>
>>>>> See the inputenc package documentation for explanation.
>>>>>
>>>>> Type  H <return>  for immediate help.
>>>>>
>>>>>   ...
>>>>>
>>>>>                                                    
>>>>>
>>>>> l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.}
>>>>>
>>>>>
>>>>> Try running pandoc with --latex-engine=xelatex.
>>>>>
>>>>> pandoc: Error producing PDF
>>>>>
>>>>>
>>>>> So the next step was to switch to xelatex based on the helpful
>>>>> suggestion from pandoc. As long as I don't try to use any babel or
>>>>> polyglossia environments, or biblatex, this works fine. But as I want to
>>>>> use both, I'm a bit stuck. First thing is that it looks like the default
>>>>> template tries to use babel rather than polyglossia if xetex is the engine.
>>>>> Is there a reason for this? (I want to use the biblatex-sbl style for my
>>>>> bibliography, and they recommend polyglossia.)
>>>>>
>>>>> I want to use English (UK) as my main language, with Hebrew and Syriac
>>>>> as other languages (I've also got some ancient Greek, but the main font
>>>>> I've chosen works fine and the output looks good for that without using a
>>>>> separate language environment).
>>>>>
>>>>> As a starting point, what language options do I set in my YAML metadata
>>>>> to enable those other two language environments, and how do I specify the
>>>>> fonts for them?
>>>>>
>>>>> Here's my YAML metadata file so far:
>>>>>
>>>>> ---
>>>>>    author: Lyndon Drake
>>>>>    documentclass: memoir
>>>>>    toc: true
>>>>>    papersize: a4
>>>>>    fontsize: 12pt
>>>>>    top-level-division: chapter
>>>>>    number-sections: true
>>>>>    mainfont: Skolar PE Light
>>>>>    mainfontoptions: Numbers=OldStyle
>>>>>    bibliography: /Users/lyndon/Documents/Media/Bibliography/0lib.bib
>>>>>    csl:
>>>>> /Users/lyndon/Documents/Media/Bibliography/society-of-biblical-literature-fullnote-bibliography.csl
>>>>>    notes-after-punctuation: true
>>>>> ---
>>>>>
>>>>> Many thanks in advance for any help on this,
>>>>> Lyndon
>>>>>
>>>>> -- 
>>>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>>>
>>>>
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> -- 
>>> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>>> <javascript:>.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
> 

-- 
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/ad97e931-ac10-0204-d03e-c646e32e4ba1%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                     ` <ad97e931-ac10-0204-d03e-c646e32e4ba1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-06-08 10:13                       ` Lyndon Drake
       [not found]                         ` <CADAJKhBNwTRaK=Htarn-YzJfCSVCeN5C-z46XBArgW1J6R3RYA@mail.gmail.com>
  0 siblings, 1 reply; 18+ messages in thread
From: Lyndon Drake @ 2017-06-08 10:13 UTC (permalink / raw)
  To: pandoc-discuss; +Cc: lyndon-S8RYeTzMgQ3QT0dZR+AlfA


[-- Attachment #1.1: Type: text/plain, Size: 13136 bytes --]

That's very helpful, thank you!

I haven't actually rewritten the LaTeX template preamble, just moved things 
around a bit, retaining all the Pandoc variables but making the package 
load order robust. I think I'll probably slightly update the template, for 
two more things:

1. it's nice to have access to two places for header insertions, one near 
the start and the other near the end of the header material once all the 
packages have been loaded;

2. the memoir class works best for books when there are \frontmatter, 
\mainmatter, and \endmatter calls in the document, so I will add options 
and a test to allow those.

I like the span syntax you've got, though in the medium term I want to work 
on an automatic filter for setting the language based on Unicode ranges and 
just use spans to cover unusual cases (although in fact, there is almost no 
case that cannot be covered by the use of Unicode direction-breaking marks 
or spaces, which have the advantage of working without any markup in HTML 
in modern browsers with font fallback mechanisms).

On Wednesday, June 7, 2017 at 5:23:54 PM UTC+1, BP Jonsson wrote:
>
> Den 2017-06-06 kl. 15:26, skrev Lyndon Drake: 
> > Thanks for this. I'd come to the conclusion that writing a latex file 
> and 
> > including the fragments that pandoc generates might be the way forward, 
> but 
> > I'm also curious to know what I've been doing wrong. 
>
> You don't need to write the whole preamble by hand, just the part 
> where you load and configure polyglossia and define the fonts 
> needed for polyglossia. 
> put them in a file called for example `poly.ltx` and then run 
> Pandoc with 
>
> ```` 
> pandoc -H poly.ltx --latex-engine=xelatex 
> ```` 
>
> I *think* this will also make the bidi bug go away. The 
> polyglossia package loads the bidi package if needed, but bidi 
> wants to be loaded after a lot of other packages which it performs 
> keyhole surgery on, including longtable and even hyperref. However 
> Pandoc's latex template, loads polyglossia quite early, 
> alternatively to loading babel. There may be no other way to fix 
> that than to use a custom template where polyglossia is loaded 
> quite late, perhaps even after the header-includes, lest the 
> latter also load some package which bidi wants to be loaded before 
> itself. I have made such a template 
> (<https://gist.github.com/bpj/5cebc975685134145cd74ca8670b1ccc>) 
> If it solves the problem please let me know and I'll make a pull 
> request for the change. 
>
> My custom template also includes my fontspec hack which lets you 
> declare font families in your metadata like this: 
>
> ```` 
> font-families: 
>    - name: '\<language>font' 
>      font:    <Font Name> 
>      options: 
>        - <key>='<value>' 
>    - name: '\greekfont' 
>      font:    GFS Neohellenic 
>      options: 
>        - Language=Greek 
>        - Script=Greek 
>        - Scale=MatchLowercase 
>        - Ligatures=TeX 
>    - name: '\sanskritfont' 
>      font:    Sahadeva 
>      options: 
>        - Language=Sanskrit 
>        - Script=Devanagari 
>    - name: '\myfancyfont' 
>      font: My Fancy 
> ```` 
>
>
> > 
> > No rush of course, but I'm keen to have a look at your filter and see 
> what 
> > it does, 
>
> It is now documented and uploaded: 
>
> <https://gist.github.com/bpj/02de1ed87ff8f8d0c31a43b9dcac1c80> 
>
> (Scroll down for the rendered documentation. The first code block 
> should suffice to understand how it works.) 
>
> It takes some initial configuration but that should be reusable by 
> including a separate YAML file on the command line with the actual 
> document. 
>
>
>
>
> even without docs. I've also found another filter on the list back 
> > in 2014 from Jesse Rosenthal that looks at Unicode ranges and wraps them 
> in 
> > a latex environment, which seems like a good idea (I've done this kind 
> of 
> > thing in InDesign grep styles and it works well for most normal bits of 
> > text). 
> > 
> > I found the lang/otherlangs documentation, but couldn't figure out from 
> the 
> > manual (might just be overlooking the correct bit) how to set a div or a 
> > span for another language. 
> > 
> > Part of the problem is that if I set lang and otherlangs as follows: 
> > 
> >    lang: en-GB 
> >    otherlangs: [he, sy] 
> >     
> > I get this: 
> > 
> > ! Package bidi Error: Oops! you have loaded package longtable after bidi 
> > packag 
> > 
> > e. Please load package longtable before bidi package, and then try to 
> run 
> > xelat 
> > 
> > ex on your document again. 
> > 
> > 
> > See the bidi package documentation for explanation. 
> > 
> > Type  H <return>  for immediate help. 
> > 
> >   ... 
> > 
> >                                                     
> > 
> > l.72 \begin{document} 
> > 
> > 
> > pandoc: Error producing PDF 
> > 
> > 
> > which I guess means that some kind of strange interaction in the latex 
> > template is producing an undesirable latex file to feed to xelatex 
> (maybe 
> > pandoc-csv2table is doing something to the produced latex?). But it kind 
> of 
> > put a stop to me experimenting with the spans and divs. 
> > 
> > Best, 
> > Lyndon 
> > 
> > On Tuesday, June 6, 2017 at 1:08:48 PM UTC+1, BPJ wrote: 
> >> 
> >> You need to use the lang and otherlang variables as described in the 
> >> manual http://pandoc.org/MANUAL if I recall correctly. 
> >> 
> >> Alternatively/additionally write a latex file containing a preamble 
> >> fragment where you load polyglossia and any languages and fonts you 
> need 
> >> with the options you need in the usual polyglossia/fontspec way and 
> include 
> >> it with the -H option. You also need to mark spans/divs containing 
> extra 
> >> languages with lang and dir attributes as appropriate. Use your 
> browser's 
> >> page search function to find these terms in the manual. 
> >> 
> >> I saw your other question about font/language switching yesterday and 
> >> started to write some documentation for the filter I use to make those 
> >> things easier. Alas I couldn't finish and today there is a national 
> holiday 
> >> in Sweden. I'll get back to it tomorrow. Basically you can use spans 
> with a 
> >> single short class like .g for greek and the filter will inject  latex 
> >> markup, docx custom style names or extended (html) attributes you have 
> >> declared to correspond to the class in your metadata. 
> >> 
> >> I can comfort you that you are much better off than I was when I 
> started 
> >> doing multilingual work with Pandoc. We had no filters, no native spans 
> or 
> >> divs and no built-in multilingual/polyglossia support back then. 
> Everything 
> >> had to be done in -H files and with raw latex in the markdown, which 
> was a 
> >> pain because I needed to make things available in HTML as well. 
> >> 
> >> I'll also update my latex template on github which contains some stuff 
> for 
> >> fontspec font loading. 
> >> 
> >> I hope this helps. I'm afraid I won't be able to check my mail for the 
> >> rest of the day. 
> >> 
> >> 
> >> tis 6 juni 2017 kl. 09:02 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org 
> >> <javascript:>>: 
> >> 
> >>> Sorry, I probably wasn't clear: I followed the instruction from Pandoc 
> >>> and switched to xelatex. Now I'm stuck trying to configure the 
> language 
> >>> options. 
> >>> 
> >>> 
> >>> On Tuesday, June 6, 2017 at 7:41:32 AM UTC+1, BP wrote: 
> >>> 
> >>>> You need  the --latex-engine=xelatex option. 
> >>>> 
> >>>> tis 6 juni 2017 kl. 07:53 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>: 
> >>>> 
> >>> Hi all, 
> >>>>> 
> >>>>> Many apologies as I'm sure this is all obvious once one knows, but 
> I'm 
> >>>>> a bit stuck. I've got some Pandoc Markdown files which I'm trying to 
> >>>>> convert to PDF using Pandoc. They include various non-ascii 
> characters, all 
> >>>>> in unicode. If I run: 
> >>>>> 
> >>>>> /usr/local/bin/pandoc -f 
> >>>>> markdown+pipe_tables+grid_tables+yaml_metadata_block --filter 
> >>>>> pandoc-citeproc --filter pandoc-csv2table -s -o formatted/Draft3.pdf 
> >>>>> text/metadata.yaml text/1-Introduction.md 
> >>>>> 
> >>>>> I get the following: 
> >>>>> 
> >>>>> ! Package inputenc Error: Unicode char ṣ (U+1E63) 
> >>>>> 
> >>>>> (inputenc)                not set up for use with LaTeX. 
> >>>>> 
> >>>>> 
> >>>>> See the inputenc package documentation for explanation. 
> >>>>> 
> >>>>> Type  H <return>  for immediate help. 
> >>>>> 
> >>>>>   ... 
> >>>>> 
> >>>>>                                                     
> >>>>> 
> >>>>> l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.} 
> >>>>> 
> >>>>> 
> >>>>> Try running pandoc with --latex-engine=xelatex. 
> >>>>> 
> >>>>> pandoc: Error producing PDF 
> >>>>> 
> >>>>> 
> >>>>> So the next step was to switch to xelatex based on the helpful 
> >>>>> suggestion from pandoc. As long as I don't try to use any babel or 
> >>>>> polyglossia environments, or biblatex, this works fine. But as I 
> want to 
> >>>>> use both, I'm a bit stuck. First thing is that it looks like the 
> default 
> >>>>> template tries to use babel rather than polyglossia if xetex is the 
> engine. 
> >>>>> Is there a reason for this? (I want to use the biblatex-sbl style 
> for my 
> >>>>> bibliography, and they recommend polyglossia.) 
> >>>>> 
> >>>>> I want to use English (UK) as my main language, with Hebrew and 
> Syriac 
> >>>>> as other languages (I've also got some ancient Greek, but the main 
> font 
> >>>>> I've chosen works fine and the output looks good for that without 
> using a 
> >>>>> separate language environment). 
> >>>>> 
> >>>>> As a starting point, what language options do I set in my YAML 
> metadata 
> >>>>> to enable those other two language environments, and how do I 
> specify the 
> >>>>> fonts for them? 
> >>>>> 
> >>>>> Here's my YAML metadata file so far: 
> >>>>> 
> >>>>> --- 
> >>>>>    author: Lyndon Drake 
> >>>>>    documentclass: memoir 
> >>>>>    toc: true 
> >>>>>    papersize: a4 
> >>>>>    fontsize: 12pt 
> >>>>>    top-level-division: chapter 
> >>>>>    number-sections: true 
> >>>>>    mainfont: Skolar PE Light 
> >>>>>    mainfontoptions: Numbers=OldStyle 
> >>>>>    bibliography: /Users/lyndon/Documents/Media/Bibliography/0lib.bib 
> >>>>>    csl: 
> >>>>> 
> /Users/lyndon/Documents/Media/Bibliography/society-of-biblical-literature-fullnote-bibliography.csl 
>
> >>>>>    notes-after-punctuation: true 
> >>>>> --- 
> >>>>> 
> >>>>> Many thanks in advance for any help on this, 
> >>>>> Lyndon 
> >>>>> 
> >>>>> -- 
> >>>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
> >>>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
> >>>> 
> >>>> 
> >>>>> To view this discussion on the web visit 
> >>>>> 
> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com 
> >>>>> <
> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com?utm_medium=email&utm_source=footer> 
>
> >>>>> . 
> >>>>> For more options, visit https://groups.google.com/d/optout. 
> >>>>> 
> >>>> -- 
> >>> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
> >>> <javascript:>. 
> >>> To view this discussion on the web visit 
> >>> 
> https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com 
> >>> <
> https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com?utm_medium=email&utm_source=footer> 
>
> >>> . 
> >>> For more options, visit https://groups.google.com/d/optout. 
> >>> 
> >> 
> > 
>
>

-- 
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/5cd094b1-ccba-4c6c-a83b-d0fa2ebf39ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 20355 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                           ` <CADAJKhBNwTRaK=Htarn-YzJfCSVCeN5C-z46XBArgW1J6R3RYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-06-08 17:20                             ` Melroch
       [not found]                               ` <CADAJKhD=6C2Zz0J3u2jB_7XyX+4+b4ui1bTr6wTG5kSVDHbYaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Melroch @ 2017-06-08 17:20 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 15531 bytes --]

The marked spans approach suits me well as in my nook of the woods
everything but Greek and modern Cyrillic languages is usually cited in
romanization.

Setting the language based on Unicode ranges with a Pandoc filter is
probably rather hard, since Pandoc splits text content into lists of
alternating Str elements, containing the non-whitespace parts, and Space
and LineBreak elements representing the whitespace parts. You will need to
locate all places in the AST where there is such a list, step through the
list looking for Str elements containing characters from one of the scripts
you are interested in and enclose sequences of alternating script character
Str elements and whitespace elements in Span elements with appropriate
attributes or raw markup elements. It is possible that this might be done
more or less efficiently with Haskell -- I don't know. If you like me don't
know Haskell it is going to be tricky. If you also want the resulting
markup to look pretty you also need to take such things as embedded
emphasis elements into consideration, not to speak of Str elements with
mixed scripts if any. I tried a poor man's substitute once, locating Greek
portions in Markdown source with a regular expression, but it was too hard
to handle punctuation sufficiently elegantly (Greek portions starting and
ending with punctuation in particular).

You mentioned the ucharclasses package which may be helpful when producing
PDF. My experience is again that punctuation inside an otherscript portion
is problematic, at least if the other script uses punctuation from general
punctuation and/or ASCII, and it still leaves you out of luck when
producing HTML. It is still best practice to wrap portions with other
directionality in elements with a dir attribute, not to mention making sure
that portions in other languages are put in divs with a lang tag, not least
for the benefit of those using assistive technologies.

Den 8 jun 2017 12:14 skrev "Lyndon Drake" <lyndon-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:

That's very helpful, thank you!

I haven't actually rewritten the LaTeX template preamble, just moved things
around a bit, retaining all the Pandoc variables but making the package
load order robust. I think I'll probably slightly update the template, for
two more things:

1. it's nice to have access to two places for header insertions, one near
the start and the other near the end of the header material once all the
packages have been loaded;

2. the memoir class works best for books when there are \frontmatter,
\mainmatter, and \endmatter calls in the document, so I will add options
and a test to allow those.

I like the span syntax you've got, though in the medium term I want to work
on an automatic filter for setting the language based on Unicode ranges and
just use spans to cover unusual cases (although in fact, there is almost no
case that cannot be covered by the use of Unicode direction-breaking marks
or spaces, which have the advantage of working without any markup in HTML
in modern browsers with font fallback mechanisms).


On Wednesday, June 7, 2017 at 5:23:54 PM UTC+1, BP Jonsson wrote:
>
> Den 2017-06-06 kl. 15:26, skrev Lyndon Drake:
> > Thanks for this. I'd come to the conclusion that writing a latex file
> and
> > including the fragments that pandoc generates might be the way forward,
> but
> > I'm also curious to know what I've been doing wrong.
>
> You don't need to write the whole preamble by hand, just the part
> where you load and configure polyglossia and define the fonts
> needed for polyglossia.
> put them in a file called for example `poly.ltx` and then run
> Pandoc with
>
> ````
> pandoc -H poly.ltx --latex-engine=xelatex
> ````
>
> I *think* this will also make the bidi bug go away. The
> polyglossia package loads the bidi package if needed, but bidi
> wants to be loaded after a lot of other packages which it performs
> keyhole surgery on, including longtable and even hyperref. However
> Pandoc's latex template, loads polyglossia quite early,
> alternatively to loading babel. There may be no other way to fix
> that than to use a custom template where polyglossia is loaded
> quite late, perhaps even after the header-includes, lest the
> latter also load some package which bidi wants to be loaded before
> itself. I have made such a template
> (<https://gist.github.com/bpj/5cebc975685134145cd74ca8670b1ccc>)
> If it solves the problem please let me know and I'll make a pull
> request for the change.
>
> My custom template also includes my fontspec hack which lets you
> declare font families in your metadata like this:
>
> ````
> font-families:
>    - name: '\<language>font'
>      font:    <Font Name>
>      options:
>        - <key>='<value>'
>    - name: '\greekfont'
>      font:    GFS Neohellenic
>      options:
>        - Language=Greek
>        - Script=Greek
>        - Scale=MatchLowercase
>        - Ligatures=TeX
>    - name: '\sanskritfont'
>      font:    Sahadeva
>      options:
>        - Language=Sanskrit
>        - Script=Devanagari
>    - name: '\myfancyfont'
>      font: My Fancy
> ````
>
>
> >
> > No rush of course, but I'm keen to have a look at your filter and see
> what
> > it does,
>
> It is now documented and uploaded:
>
> <https://gist.github.com/bpj/02de1ed87ff8f8d0c31a43b9dcac1c80>
>
> (Scroll down for the rendered documentation. The first code block
> should suffice to understand how it works.)
>
> It takes some initial configuration but that should be reusable by
> including a separate YAML file on the command line with the actual
> document.
>
>
>
>
> even without docs. I've also found another filter on the list back
> > in 2014 from Jesse Rosenthal that looks at Unicode ranges and wraps them
> in
> > a latex environment, which seems like a good idea (I've done this kind
> of
> > thing in InDesign grep styles and it works well for most normal bits of
> > text).
> >
> > I found the lang/otherlangs documentation, but couldn't figure out from
> the
> > manual (might just be overlooking the correct bit) how to set a div or a
> > span for another language.
> >
> > Part of the problem is that if I set lang and otherlangs as follows:
> >
> >    lang: en-GB
> >    otherlangs: [he, sy]
> >
> > I get this:
> >
> > ! Package bidi Error: Oops! you have loaded package longtable after bidi
> > packag
> >
> > e. Please load package longtable before bidi package, and then try to
> run
> > xelat
> >
> > ex on your document again.
> >
> >
> > See the bidi package documentation for explanation.
> >
> > Type  H <return>  for immediate help.
> >
> >   ...
> >
> >
> >
> > l.72 \begin{document}
> >
> >
> > pandoc: Error producing PDF
> >
> >
> > which I guess means that some kind of strange interaction in the latex
> > template is producing an undesirable latex file to feed to xelatex
> (maybe
> > pandoc-csv2table is doing something to the produced latex?). But it kind
> of
> > put a stop to me experimenting with the spans and divs.
> >
> > Best,
> > Lyndon
> >
> > On Tuesday, June 6, 2017 at 1:08:48 PM UTC+1, BPJ wrote:
> >>
> >> You need to use the lang and otherlang variables as described in the
> >> manual http://pandoc.org/MANUAL if I recall correctly.
> >>
> >> Alternatively/additionally write a latex file containing a preamble
> >> fragment where you load polyglossia and any languages and fonts you
> need
> >> with the options you need in the usual polyglossia/fontspec way and
> include
> >> it with the -H option. You also need to mark spans/divs containing
> extra
> >> languages with lang and dir attributes as appropriate. Use your
> browser's
> >> page search function to find these terms in the manual.
> >>
> >> I saw your other question about font/language switching yesterday and
> >> started to write some documentation for the filter I use to make those
> >> things easier. Alas I couldn't finish and today there is a national
> holiday
> >> in Sweden. I'll get back to it tomorrow. Basically you can use spans
> with a
> >> single short class like .g for greek and the filter will inject  latex
> >> markup, docx custom style names or extended (html) attributes you have
> >> declared to correspond to the class in your metadata.
> >>
> >> I can comfort you that you are much better off than I was when I
> started
> >> doing multilingual work with Pandoc. We had no filters, no native spans
> or
> >> divs and no built-in multilingual/polyglossia support back then.
> Everything
> >> had to be done in -H files and with raw latex in the markdown, which
> was a
> >> pain because I needed to make things available in HTML as well.
> >>
> >> I'll also update my latex template on github which contains some stuff
> for
> >> fontspec font loading.
> >>
> >> I hope this helps. I'm afraid I won't be able to check my mail for the
> >> rest of the day.
> >>
> >>
> >> tis 6 juni 2017 kl. 09:02 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org
> >> <javascript:>>:
> >>
> >>> Sorry, I probably wasn't clear: I followed the instruction from Pandoc
> >>> and switched to xelatex. Now I'm stuck trying to configure the
> language
> >>> options.
> >>>
> >>>
> >>> On Tuesday, June 6, 2017 at 7:41:32 AM UTC+1, BP wrote:
> >>>
> >>>> You need  the --latex-engine=xelatex option.
> >>>>
> >>>> tis 6 juni 2017 kl. 07:53 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:
> >>>>
> >>> Hi all,
> >>>>>
> >>>>> Many apologies as I'm sure this is all obvious once one knows, but
> I'm
> >>>>> a bit stuck. I've got some Pandoc Markdown files which I'm trying to
> >>>>> convert to PDF using Pandoc. They include various non-ascii
> characters, all
> >>>>> in unicode. If I run:
> >>>>>
> >>>>> /usr/local/bin/pandoc -f
> >>>>> markdown+pipe_tables+grid_tables+yaml_metadata_block --filter
> >>>>> pandoc-citeproc --filter pandoc-csv2table -s -o formatted/Draft3.pdf
> >>>>> text/metadata.yaml text/1-Introduction.md
> >>>>>
> >>>>> I get the following:
> >>>>>
> >>>>> ! Package inputenc Error: Unicode char ṣ (U+1E63)
> >>>>>
> >>>>> (inputenc)                not set up for use with LaTeX.
> >>>>>
> >>>>>
> >>>>> See the inputenc package documentation for explanation.
> >>>>>
> >>>>> Type  H <return>  for immediate help.
> >>>>>
> >>>>>   ...
> >>>>>
> >>>>>
> >>>>>
> >>>>> l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.}
> >>>>>
> >>>>>
> >>>>> Try running pandoc with --latex-engine=xelatex.
> >>>>>
> >>>>> pandoc: Error producing PDF
> >>>>>
> >>>>>
> >>>>> So the next step was to switch to xelatex based on the helpful
> >>>>> suggestion from pandoc. As long as I don't try to use any babel or
> >>>>> polyglossia environments, or biblatex, this works fine. But as I
> want to
> >>>>> use both, I'm a bit stuck. First thing is that it looks like the
> default
> >>>>> template tries to use babel rather than polyglossia if xetex is the
> engine.
> >>>>> Is there a reason for this? (I want to use the biblatex-sbl style
> for my
> >>>>> bibliography, and they recommend polyglossia.)
> >>>>>
> >>>>> I want to use English (UK) as my main language, with Hebrew and
> Syriac
> >>>>> as other languages (I've also got some ancient Greek, but the main
> font
> >>>>> I've chosen works fine and the output looks good for that without
> using a
> >>>>> separate language environment).
> >>>>>
> >>>>> As a starting point, what language options do I set in my YAML
> metadata
> >>>>> to enable those other two language environments, and how do I
> specify the
> >>>>> fonts for them?
> >>>>>
> >>>>> Here's my YAML metadata file so far:
> >>>>>
> >>>>> ---
> >>>>>    author: Lyndon Drake
> >>>>>    documentclass: memoir
> >>>>>    toc: true
> >>>>>    papersize: a4
> >>>>>    fontsize: 12pt
> >>>>>    top-level-division: chapter
> >>>>>    number-sections: true
> >>>>>    mainfont: Skolar PE Light
> >>>>>    mainfontoptions: Numbers=OldStyle
> >>>>>    bibliography: /Users/lyndon/Documents/Media/Bibliography/0lib.bib
>
> >>>>>    csl:
> >>>>> /Users/lyndon/Documents/Media/Bibliography/society-of-biblic
> al-literature-fullnote-bibliography.csl
> >>>>>    notes-after-punctuation: true
> >>>>> ---
> >>>>>
> >>>>> Many thanks in advance for any help on this,
> >>>>> Lyndon
> >>>>>
> >>>>> --
> >>>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >>>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >>>>
> >>>>
> >>>>> To view this discussion on the web visit
> >>>>> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f8
> 83-4853-a97f-a81861395b78%40googlegroups.com
> >>>>> <https://groups.google.com/d/msgid/pandoc-discuss/89122680-f
> 883-4853-a97f-a81861395b78%40googlegroups.com?utm_medium=ema
> il&utm_source=footer>
> >>>>> .
> >>>>> For more options, visit https://groups.google.com/d/optout.
> >>>>>
> >>>> --
> >>> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
> >>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> >>> <javascript:>.
> >>> To view this discussion on the web visit
> >>> https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a
> 82-4a0d-8bb4-4ec2513723fe%40googlegroups.com
> >>> <https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3
> a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com?utm_medium=ema
> il&utm_source=footer>
> >>> .
> >>> For more options, visit https://groups.google.com/d/optout.
> >>>
> >>
> >
>
> --
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/5cd094b1-ccba-4c6c-a83b-d0fa2ebf39ba%40googlegroups.com
<https://groups.google.com/d/msgid/pandoc-discuss/5cd094b1-ccba-4c6c-a83b-d0fa2ebf39ba%40googlegroups.com?utm_medium=email&utm_source=footer>
.

For more options, visit https://groups.google.com/d/optout.

-- 
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/CADAJKhD%3D6C2Zz0J3u2jB_7XyX%2B4%2Bb4ui1bTr6wTG5kSVDHbYaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 20990 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                               ` <CADAJKhD=6C2Zz0J3u2jB_7XyX+4+b4ui1bTr6wTG5kSVDHbYaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-06-09  8:02                                 ` Lyndon Drake
       [not found]                                   ` <a5d78535-d049-49c9-a77b-ddfa3b226302-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Lyndon Drake @ 2017-06-09  8:02 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 17070 bytes --]

I did once know Haskell, but these days it makes my head hurt a bit. I'll 
have a go later this summer once exams are out of the way. I think it's 
feasible (partly because I've seen it implemented elsewhere) but I could 
easily be wrong, in which case I'll fall back on the marked spans. Your 
filter does at least make them minimally invasive. I just don't like the 
way it clutters up the text-only view with markup, which is the number one 
reason I'm trying to use Markdown instead of just using LaTeX directly.

Thanks again for the help.

On Thursday, June 8, 2017 at 6:20:11 PM UTC+1, BP wrote:
>
> The marked spans approach suits me well as in my nook of the woods 
> everything but Greek and modern Cyrillic languages is usually cited in 
> romanization.
>
> Setting the language based on Unicode ranges with a Pandoc filter is 
> probably rather hard, since Pandoc splits text content into lists of 
> alternating Str elements, containing the non-whitespace parts, and Space 
> and LineBreak elements representing the whitespace parts. You will need to 
> locate all places in the AST where there is such a list, step through the 
> list looking for Str elements containing characters from one of the scripts 
> you are interested in and enclose sequences of alternating script character 
> Str elements and whitespace elements in Span elements with appropriate 
> attributes or raw markup elements. It is possible that this might be done 
> more or less efficiently with Haskell -- I don't know. If you like me don't 
> know Haskell it is going to be tricky. If you also want the resulting 
> markup to look pretty you also need to take such things as embedded 
> emphasis elements into consideration, not to speak of Str elements with 
> mixed scripts if any. I tried a poor man's substitute once, locating Greek 
> portions in Markdown source with a regular expression, but it was too hard 
> to handle punctuation sufficiently elegantly (Greek portions starting and 
> ending with punctuation in particular).
>
> You mentioned the ucharclasses package which may be helpful when producing 
> PDF. My experience is again that punctuation inside an otherscript portion 
> is problematic, at least if the other script uses punctuation from general 
> punctuation and/or ASCII, and it still leaves you out of luck when 
> producing HTML. It is still best practice to wrap portions with other 
> directionality in elements with a dir attribute, not to mention making sure 
> that portions in other languages are put in divs with a lang tag, not least 
> for the benefit of those using assistive technologies.
>
> Den 8 jun 2017 12:14 skrev "Lyndon Drake" <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org <javascript:>
> >:
>
> That's very helpful, thank you!
>
> I haven't actually rewritten the LaTeX template preamble, just moved 
> things around a bit, retaining all the Pandoc variables but making the 
> package load order robust. I think I'll probably slightly update the 
> template, for two more things:
>
> 1. it's nice to have access to two places for header insertions, one near 
> the start and the other near the end of the header material once all the 
> packages have been loaded;
>
> 2. the memoir class works best for books when there are \frontmatter, 
> \mainmatter, and \endmatter calls in the document, so I will add options 
> and a test to allow those.
>
> I like the span syntax you've got, though in the medium term I want to 
> work on an automatic filter for setting the language based on Unicode 
> ranges and just use spans to cover unusual cases (although in fact, there 
> is almost no case that cannot be covered by the use of Unicode 
> direction-breaking marks or spaces, which have the advantage of working 
> without any markup in HTML in modern browsers with font fallback 
> mechanisms).
>
>
> On Wednesday, June 7, 2017 at 5:23:54 PM UTC+1, BP Jonsson wrote:
>>
>> Den 2017-06-06 kl. 15:26, skrev Lyndon Drake: 
>> > Thanks for this. I'd come to the conclusion that writing a latex file 
>> and 
>> > including the fragments that pandoc generates might be the way forward, 
>> but 
>> > I'm also curious to know what I've been doing wrong. 
>>
>> You don't need to write the whole preamble by hand, just the part 
>> where you load and configure polyglossia and define the fonts 
>> needed for polyglossia. 
>> put them in a file called for example `poly.ltx` and then run 
>> Pandoc with 
>>
>> ```` 
>> pandoc -H poly.ltx --latex-engine=xelatex 
>> ```` 
>>
>> I *think* this will also make the bidi bug go away. The 
>> polyglossia package loads the bidi package if needed, but bidi 
>> wants to be loaded after a lot of other packages which it performs 
>> keyhole surgery on, including longtable and even hyperref. However 
>> Pandoc's latex template, loads polyglossia quite early, 
>> alternatively to loading babel. There may be no other way to fix 
>> that than to use a custom template where polyglossia is loaded 
>> quite late, perhaps even after the header-includes, lest the 
>> latter also load some package which bidi wants to be loaded before 
>> itself. I have made such a template 
>> (<https://gist.github.com/bpj/5cebc975685134145cd74ca8670b1ccc>) 
>> If it solves the problem please let me know and I'll make a pull 
>> request for the change. 
>>
>> My custom template also includes my fontspec hack which lets you 
>> declare font families in your metadata like this: 
>>
>> ```` 
>> font-families: 
>>    - name: '\<language>font' 
>>      font:    <Font Name> 
>>      options: 
>>        - <key>='<value>' 
>>    - name: '\greekfont' 
>>      font:    GFS Neohellenic 
>>      options: 
>>        - Language=Greek 
>>        - Script=Greek 
>>        - Scale=MatchLowercase 
>>        - Ligatures=TeX 
>>    - name: '\sanskritfont' 
>>      font:    Sahadeva 
>>      options: 
>>        - Language=Sanskrit 
>>        - Script=Devanagari 
>>    - name: '\myfancyfont' 
>>      font: My Fancy 
>> ```` 
>>
>>
>> > 
>> > No rush of course, but I'm keen to have a look at your filter and see 
>> what 
>> > it does, 
>>
>> It is now documented and uploaded: 
>>
>> <https://gist.github.com/bpj/02de1ed87ff8f8d0c31a43b9dcac1c80> 
>>
>> (Scroll down for the rendered documentation. The first code block 
>> should suffice to understand how it works.) 
>>
>> It takes some initial configuration but that should be reusable by 
>> including a separate YAML file on the command line with the actual 
>> document. 
>>
>>
>>
>>
>> even without docs. I've also found another filter on the list back 
>> > in 2014 from Jesse Rosenthal that looks at Unicode ranges and wraps 
>> them in 
>> > a latex environment, which seems like a good idea (I've done this kind 
>> of 
>> > thing in InDesign grep styles and it works well for most normal bits of 
>> > text). 
>> > 
>> > I found the lang/otherlangs documentation, but couldn't figure out from 
>> the 
>> > manual (might just be overlooking the correct bit) how to set a div or 
>> a 
>> > span for another language. 
>> > 
>> > Part of the problem is that if I set lang and otherlangs as follows: 
>> > 
>> >    lang: en-GB 
>> >    otherlangs: [he, sy] 
>> >     
>> > I get this: 
>> > 
>> > ! Package bidi Error: Oops! you have loaded package longtable after 
>> bidi 
>> > packag 
>> > 
>> > e. Please load package longtable before bidi package, and then try to 
>> run 
>> > xelat 
>> > 
>> > ex on your document again. 
>> > 
>> > 
>> > See the bidi package documentation for explanation. 
>> > 
>> > Type  H <return>  for immediate help. 
>> > 
>> >   ... 
>> > 
>> >                                                     
>> > 
>> > l.72 \begin{document} 
>> > 
>> > 
>> > pandoc: Error producing PDF 
>> > 
>> > 
>> > which I guess means that some kind of strange interaction in the latex 
>> > template is producing an undesirable latex file to feed to xelatex 
>> (maybe 
>> > pandoc-csv2table is doing something to the produced latex?). But it 
>> kind of 
>> > put a stop to me experimenting with the spans and divs. 
>> > 
>> > Best, 
>> > Lyndon 
>> > 
>> > On Tuesday, June 6, 2017 at 1:08:48 PM UTC+1, BPJ wrote: 
>> >> 
>> >> You need to use the lang and otherlang variables as described in the 
>> >> manual http://pandoc.org/MANUAL if I recall correctly. 
>> >> 
>> >> Alternatively/additionally write a latex file containing a preamble 
>> >> fragment where you load polyglossia and any languages and fonts you 
>> need 
>> >> with the options you need in the usual polyglossia/fontspec way and 
>> include 
>> >> it with the -H option. You also need to mark spans/divs containing 
>> extra 
>> >> languages with lang and dir attributes as appropriate. Use your 
>> browser's 
>> >> page search function to find these terms in the manual. 
>> >> 
>> >> I saw your other question about font/language switching yesterday and 
>> >> started to write some documentation for the filter I use to make those 
>> >> things easier. Alas I couldn't finish and today there is a national 
>> holiday 
>> >> in Sweden. I'll get back to it tomorrow. Basically you can use spans 
>> with a 
>> >> single short class like .g for greek and the filter will inject  latex 
>> >> markup, docx custom style names or extended (html) attributes you have 
>> >> declared to correspond to the class in your metadata. 
>> >> 
>> >> I can comfort you that you are much better off than I was when I 
>> started 
>> >> doing multilingual work with Pandoc. We had no filters, no native 
>> spans or 
>> >> divs and no built-in multilingual/polyglossia support back then. 
>> Everything 
>> >> had to be done in -H files and with raw latex in the markdown, which 
>> was a 
>> >> pain because I needed to make things available in HTML as well. 
>> >> 
>> >> I'll also update my latex template on github which contains some stuff 
>> for 
>> >> fontspec font loading. 
>> >> 
>> >> I hope this helps. I'm afraid I won't be able to check my mail for the 
>> >> rest of the day. 
>> >> 
>> >> 
>> >> tis 6 juni 2017 kl. 09:02 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org 
>> >> <javascript:>>: 
>> >> 
>> >>> Sorry, I probably wasn't clear: I followed the instruction from 
>> Pandoc 
>> >>> and switched to xelatex. Now I'm stuck trying to configure the 
>> language 
>> >>> options. 
>> >>> 
>> >>> 
>> >>> On Tuesday, June 6, 2017 at 7:41:32 AM UTC+1, BP wrote: 
>> >>> 
>> >>>> You need  the --latex-engine=xelatex option. 
>> >>>> 
>> >>>> tis 6 juni 2017 kl. 07:53 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>: 
>> >>>> 
>> >>> Hi all, 
>> >>>>> 
>> >>>>> Many apologies as I'm sure this is all obvious once one knows, but 
>> I'm 
>> >>>>> a bit stuck. I've got some Pandoc Markdown files which I'm trying 
>> to 
>> >>>>> convert to PDF using Pandoc. They include various non-ascii 
>> characters, all 
>> >>>>> in unicode. If I run: 
>> >>>>> 
>> >>>>> /usr/local/bin/pandoc -f 
>> >>>>> markdown+pipe_tables+grid_tables+yaml_metadata_block --filter 
>> >>>>> pandoc-citeproc --filter pandoc-csv2table -s -o 
>> formatted/Draft3.pdf 
>> >>>>> text/metadata.yaml text/1-Introduction.md 
>> >>>>> 
>> >>>>> I get the following: 
>> >>>>> 
>> >>>>> ! Package inputenc Error: Unicode char ṣ (U+1E63) 
>> >>>>> 
>> >>>>> (inputenc)                not set up for use with LaTeX. 
>> >>>>> 
>> >>>>> 
>> >>>>> See the inputenc package documentation for explanation. 
>> >>>>> 
>> >>>>> Type  H <return>  for immediate help. 
>> >>>>> 
>> >>>>>   ... 
>> >>>>> 
>> >>>>>                                                     
>> >>>>> 
>> >>>>> l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.} 
>> >>>>> 
>> >>>>> 
>> >>>>> Try running pandoc with --latex-engine=xelatex. 
>> >>>>> 
>> >>>>> pandoc: Error producing PDF 
>> >>>>> 
>> >>>>> 
>> >>>>> So the next step was to switch to xelatex based on the helpful 
>> >>>>> suggestion from pandoc. As long as I don't try to use any babel or 
>> >>>>> polyglossia environments, or biblatex, this works fine. But as I 
>> want to 
>> >>>>> use both, I'm a bit stuck. First thing is that it looks like the 
>> default 
>> >>>>> template tries to use babel rather than polyglossia if xetex is the 
>> engine. 
>> >>>>> Is there a reason for this? (I want to use the biblatex-sbl style 
>> for my 
>> >>>>> bibliography, and they recommend polyglossia.) 
>> >>>>> 
>> >>>>> I want to use English (UK) as my main language, with Hebrew and 
>> Syriac 
>> >>>>> as other languages (I've also got some ancient Greek, but the main 
>> font 
>> >>>>> I've chosen works fine and the output looks good for that without 
>> using a 
>> >>>>> separate language environment). 
>> >>>>> 
>> >>>>> As a starting point, what language options do I set in my YAML 
>> metadata 
>> >>>>> to enable those other two language environments, and how do I 
>> specify the 
>> >>>>> fonts for them? 
>> >>>>> 
>> >>>>> Here's my YAML metadata file so far: 
>> >>>>> 
>> >>>>> --- 
>> >>>>>    author: Lyndon Drake 
>> >>>>>    documentclass: memoir 
>> >>>>>    toc: true 
>> >>>>>    papersize: a4 
>> >>>>>    fontsize: 12pt 
>> >>>>>    top-level-division: chapter 
>> >>>>>    number-sections: true 
>> >>>>>    mainfont: Skolar PE Light 
>> >>>>>    mainfontoptions: Numbers=OldStyle 
>> >>>>>    bibliography: 
>> /Users/lyndon/Documents/Media/Bibliography/0lib.bib 
>> >>>>>    csl: 
>> >>>>> 
>> /Users/lyndon/Documents/Media/Bibliography/society-of-biblical-literature-fullnote-bibliography.csl 
>>
>> >>>>>    notes-after-punctuation: true 
>> >>>>> --- 
>> >>>>> 
>> >>>>> Many thanks in advance for any help on this, 
>> >>>>> Lyndon 
>> >>>>> 
>> >>>>> -- 
>> >>>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
>> >>>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
>> >>>> 
>> >>>> 
>> >>>>> To view this discussion on the web visit 
>> >>>>> 
>> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com 
>> >>>>> <
>> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com?utm_medium=email&utm_source=footer> 
>>
>> >>>>> . 
>> >>>>> For more options, visit https://groups.google.com/d/optout. 
>> >>>>> 
>> >>>> -- 
>> >>> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
>> >>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
>> >>> <javascript:>. 
>> >>> To view this discussion on the web visit 
>> >>> 
>> https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com 
>> >>> <
>> https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com?utm_medium=email&utm_source=footer> 
>>
>> >>> . 
>> >>> For more options, visit https://groups.google.com/d/optout. 
>> >>> 
>> >> 
>> > 
>>
>> -- 
> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
> <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/5cd094b1-ccba-4c6c-a83b-d0fa2ebf39ba%40googlegroups.com 
> <https://groups.google.com/d/msgid/pandoc-discuss/5cd094b1-ccba-4c6c-a83b-d0fa2ebf39ba%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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/a5d78535-d049-49c9-a77b-ddfa3b226302%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 25556 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                                   ` <a5d78535-d049-49c9-a77b-ddfa3b226302-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-06-09 11:12                                     ` Melroch
       [not found]                                       ` <CADAJKhDeJ6fWqdr36Yd1fgZLbTL6FZGVPGahNN44HoezJo69dQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Melroch @ 2017-06-09 11:12 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 18835 bytes --]

On occasion I have used some of the many Unicode bracket pairs as
delimiters and replaced them with the corresponding LaTeX or HTML markup by
regular expression or by making them active in XeLaTeX. They're minimally
invasive but can be a pain to type, and it taxes the memory to remember
which is which. I would end up defining a code snippet where I anyway would
type something like `..grc TEXT<tab>` and then I think I can just as well
have the same snippet expand to a span. It's so much less invasive now that
Pandoc supports bracketed spans. As always how you see things depends on
where you are coming from. Back in the early nineties I had to make my own
8-bit fonts and do the necessary incantations to make them work with LaTeX,
and I wrote my own script which sorted and marked up word indexes, a must
have in comparative philology. In fact I still use a descendant of it;
things are both easier and harder with Unicode!


Den 9 jun 2017 10:03 skrev "Lyndon Drake" <lyndon-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:

> I did once know Haskell, but these days it makes my head hurt a bit. I'll
> have a go later this summer once exams are out of the way. I think it's
> feasible (partly because I've seen it implemented elsewhere) but I could
> easily be wrong, in which case I'll fall back on the marked spans. Your
> filter does at least make them minimally invasive. I just don't like the
> way it clutters up the text-only view with markup, which is the number one
> reason I'm trying to use Markdown instead of just using LaTeX directly.
>
> Thanks again for the help.
>
> On Thursday, June 8, 2017 at 6:20:11 PM UTC+1, BP wrote:
>>
>> The marked spans approach suits me well as in my nook of the woods
>> everything but Greek and modern Cyrillic languages is usually cited in
>> romanization.
>>
>> Setting the language based on Unicode ranges with a Pandoc filter is
>> probably rather hard, since Pandoc splits text content into lists of
>> alternating Str elements, containing the non-whitespace parts, and Space
>> and LineBreak elements representing the whitespace parts. You will need to
>> locate all places in the AST where there is such a list, step through the
>> list looking for Str elements containing characters from one of the scripts
>> you are interested in and enclose sequences of alternating script character
>> Str elements and whitespace elements in Span elements with appropriate
>> attributes or raw markup elements. It is possible that this might be done
>> more or less efficiently with Haskell -- I don't know. If you like me don't
>> know Haskell it is going to be tricky. If you also want the resulting
>> markup to look pretty you also need to take such things as embedded
>> emphasis elements into consideration, not to speak of Str elements with
>> mixed scripts if any. I tried a poor man's substitute once, locating Greek
>> portions in Markdown source with a regular expression, but it was too hard
>> to handle punctuation sufficiently elegantly (Greek portions starting and
>> ending with punctuation in particular).
>>
>> You mentioned the ucharclasses package which may be helpful when
>> producing PDF. My experience is again that punctuation inside an
>> otherscript portion is problematic, at least if the other script uses
>> punctuation from general punctuation and/or ASCII, and it still leaves you
>> out of luck when producing HTML. It is still best practice to wrap portions
>> with other directionality in elements with a dir attribute, not to mention
>> making sure that portions in other languages are put in divs with a lang
>> tag, not least for the benefit of those using assistive technologies.
>>
>> Den 8 jun 2017 12:14 skrev "Lyndon Drake" <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:
>>
>> That's very helpful, thank you!
>>
>> I haven't actually rewritten the LaTeX template preamble, just moved
>> things around a bit, retaining all the Pandoc variables but making the
>> package load order robust. I think I'll probably slightly update the
>> template, for two more things:
>>
>> 1. it's nice to have access to two places for header insertions, one near
>> the start and the other near the end of the header material once all the
>> packages have been loaded;
>>
>> 2. the memoir class works best for books when there are \frontmatter,
>> \mainmatter, and \endmatter calls in the document, so I will add options
>> and a test to allow those.
>>
>> I like the span syntax you've got, though in the medium term I want to
>> work on an automatic filter for setting the language based on Unicode
>> ranges and just use spans to cover unusual cases (although in fact, there
>> is almost no case that cannot be covered by the use of Unicode
>> direction-breaking marks or spaces, which have the advantage of working
>> without any markup in HTML in modern browsers with font fallback
>> mechanisms).
>>
>>
>> On Wednesday, June 7, 2017 at 5:23:54 PM UTC+1, BP Jonsson wrote:
>>>
>>> Den 2017-06-06 kl. 15:26, skrev Lyndon Drake:
>>> > Thanks for this. I'd come to the conclusion that writing a latex file
>>> and
>>> > including the fragments that pandoc generates might be the way
>>> forward, but
>>> > I'm also curious to know what I've been doing wrong.
>>>
>>> You don't need to write the whole preamble by hand, just the part
>>> where you load and configure polyglossia and define the fonts
>>> needed for polyglossia.
>>> put them in a file called for example `poly.ltx` and then run
>>> Pandoc with
>>>
>>> ````
>>> pandoc -H poly.ltx --latex-engine=xelatex
>>> ````
>>>
>>> I *think* this will also make the bidi bug go away. The
>>> polyglossia package loads the bidi package if needed, but bidi
>>> wants to be loaded after a lot of other packages which it performs
>>> keyhole surgery on, including longtable and even hyperref. However
>>> Pandoc's latex template, loads polyglossia quite early,
>>> alternatively to loading babel. There may be no other way to fix
>>> that than to use a custom template where polyglossia is loaded
>>> quite late, perhaps even after the header-includes, lest the
>>> latter also load some package which bidi wants to be loaded before
>>> itself. I have made such a template
>>> (<https://gist.github.com/bpj/5cebc975685134145cd74ca8670b1ccc>)
>>> If it solves the problem please let me know and I'll make a pull
>>> request for the change.
>>>
>>> My custom template also includes my fontspec hack which lets you
>>> declare font families in your metadata like this:
>>>
>>> ````
>>> font-families:
>>>    - name: '\<language>font'
>>>      font:    <Font Name>
>>>      options:
>>>        - <key>='<value>'
>>>    - name: '\greekfont'
>>>      font:    GFS Neohellenic
>>>      options:
>>>        - Language=Greek
>>>        - Script=Greek
>>>        - Scale=MatchLowercase
>>>        - Ligatures=TeX
>>>    - name: '\sanskritfont'
>>>      font:    Sahadeva
>>>      options:
>>>        - Language=Sanskrit
>>>        - Script=Devanagari
>>>    - name: '\myfancyfont'
>>>      font: My Fancy
>>> ````
>>>
>>>
>>> >
>>> > No rush of course, but I'm keen to have a look at your filter and see
>>> what
>>> > it does,
>>>
>>> It is now documented and uploaded:
>>>
>>> <https://gist.github.com/bpj/02de1ed87ff8f8d0c31a43b9dcac1c80>
>>>
>>> (Scroll down for the rendered documentation. The first code block
>>> should suffice to understand how it works.)
>>>
>>> It takes some initial configuration but that should be reusable by
>>> including a separate YAML file on the command line with the actual
>>> document.
>>>
>>>
>>>
>>>
>>> even without docs. I've also found another filter on the list back
>>> > in 2014 from Jesse Rosenthal that looks at Unicode ranges and wraps
>>> them in
>>> > a latex environment, which seems like a good idea (I've done this kind
>>> of
>>> > thing in InDesign grep styles and it works well for most normal bits
>>> of
>>> > text).
>>> >
>>> > I found the lang/otherlangs documentation, but couldn't figure out
>>> from the
>>> > manual (might just be overlooking the correct bit) how to set a div or
>>> a
>>> > span for another language.
>>> >
>>> > Part of the problem is that if I set lang and otherlangs as follows:
>>> >
>>> >    lang: en-GB
>>> >    otherlangs: [he, sy]
>>> >
>>> > I get this:
>>> >
>>> > ! Package bidi Error: Oops! you have loaded package longtable after
>>> bidi
>>> > packag
>>> >
>>> > e. Please load package longtable before bidi package, and then try to
>>> run
>>> > xelat
>>> >
>>> > ex on your document again.
>>> >
>>> >
>>> > See the bidi package documentation for explanation.
>>> >
>>> > Type  H <return>  for immediate help.
>>> >
>>> >   ...
>>> >
>>> >
>>> >
>>> > l.72 \begin{document}
>>> >
>>> >
>>> > pandoc: Error producing PDF
>>> >
>>> >
>>> > which I guess means that some kind of strange interaction in the latex
>>> > template is producing an undesirable latex file to feed to xelatex
>>> (maybe
>>> > pandoc-csv2table is doing something to the produced latex?). But it
>>> kind of
>>> > put a stop to me experimenting with the spans and divs.
>>> >
>>> > Best,
>>> > Lyndon
>>> >
>>> > On Tuesday, June 6, 2017 at 1:08:48 PM UTC+1, BPJ wrote:
>>> >>
>>> >> You need to use the lang and otherlang variables as described in the
>>> >> manual http://pandoc.org/MANUAL if I recall correctly.
>>> >>
>>> >> Alternatively/additionally write a latex file containing a preamble
>>> >> fragment where you load polyglossia and any languages and fonts you
>>> need
>>> >> with the options you need in the usual polyglossia/fontspec way and
>>> include
>>> >> it with the -H option. You also need to mark spans/divs containing
>>> extra
>>> >> languages with lang and dir attributes as appropriate. Use your
>>> browser's
>>> >> page search function to find these terms in the manual.
>>> >>
>>> >> I saw your other question about font/language switching yesterday and
>>> >> started to write some documentation for the filter I use to make
>>> those
>>> >> things easier. Alas I couldn't finish and today there is a national
>>> holiday
>>> >> in Sweden. I'll get back to it tomorrow. Basically you can use spans
>>> with a
>>> >> single short class like .g for greek and the filter will inject
>>>  latex
>>> >> markup, docx custom style names or extended (html) attributes you
>>> have
>>> >> declared to correspond to the class in your metadata.
>>> >>
>>> >> I can comfort you that you are much better off than I was when I
>>> started
>>> >> doing multilingual work with Pandoc. We had no filters, no native
>>> spans or
>>> >> divs and no built-in multilingual/polyglossia support back then.
>>> Everything
>>> >> had to be done in -H files and with raw latex in the markdown, which
>>> was a
>>> >> pain because I needed to make things available in HTML as well.
>>> >>
>>> >> I'll also update my latex template on github which contains some
>>> stuff for
>>> >> fontspec font loading.
>>> >>
>>> >> I hope this helps. I'm afraid I won't be able to check my mail for
>>> the
>>> >> rest of the day.
>>> >>
>>> >>
>>> >> tis 6 juni 2017 kl. 09:02 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org
>>> >> <javascript:>>:
>>> >>
>>> >>> Sorry, I probably wasn't clear: I followed the instruction from
>>> Pandoc
>>> >>> and switched to xelatex. Now I'm stuck trying to configure the
>>> language
>>> >>> options.
>>> >>>
>>> >>>
>>> >>> On Tuesday, June 6, 2017 at 7:41:32 AM UTC+1, BP wrote:
>>> >>>
>>> >>>> You need  the --latex-engine=xelatex option.
>>> >>>>
>>> >>>> tis 6 juni 2017 kl. 07:53 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:
>>> >>>>
>>> >>> Hi all,
>>> >>>>>
>>> >>>>> Many apologies as I'm sure this is all obvious once one knows, but
>>> I'm
>>> >>>>> a bit stuck. I've got some Pandoc Markdown files which I'm trying
>>> to
>>> >>>>> convert to PDF using Pandoc. They include various non-ascii
>>> characters, all
>>> >>>>> in unicode. If I run:
>>> >>>>>
>>> >>>>> /usr/local/bin/pandoc -f
>>> >>>>> markdown+pipe_tables+grid_tables+yaml_metadata_block --filter
>>> >>>>> pandoc-citeproc --filter pandoc-csv2table -s -o
>>> formatted/Draft3.pdf
>>> >>>>> text/metadata.yaml text/1-Introduction.md
>>> >>>>>
>>> >>>>> I get the following:
>>> >>>>>
>>> >>>>> ! Package inputenc Error: Unicode char ṣ (U+1E63)
>>> >>>>>
>>> >>>>> (inputenc)                not set up for use with LaTeX.
>>> >>>>>
>>> >>>>>
>>> >>>>> See the inputenc package documentation for explanation.
>>> >>>>>
>>> >>>>> Type  H <return>  for immediate help.
>>> >>>>>
>>> >>>>>   ...
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>> l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.}
>>> >>>>>
>>> >>>>>
>>> >>>>> Try running pandoc with --latex-engine=xelatex.
>>> >>>>>
>>> >>>>> pandoc: Error producing PDF
>>> >>>>>
>>> >>>>>
>>> >>>>> So the next step was to switch to xelatex based on the helpful
>>> >>>>> suggestion from pandoc. As long as I don't try to use any babel or
>>> >>>>> polyglossia environments, or biblatex, this works fine. But as I
>>> want to
>>> >>>>> use both, I'm a bit stuck. First thing is that it looks like the
>>> default
>>> >>>>> template tries to use babel rather than polyglossia if xetex is
>>> the engine.
>>> >>>>> Is there a reason for this? (I want to use the biblatex-sbl style
>>> for my
>>> >>>>> bibliography, and they recommend polyglossia.)
>>> >>>>>
>>> >>>>> I want to use English (UK) as my main language, with Hebrew and
>>> Syriac
>>> >>>>> as other languages (I've also got some ancient Greek, but the main
>>> font
>>> >>>>> I've chosen works fine and the output looks good for that without
>>> using a
>>> >>>>> separate language environment).
>>> >>>>>
>>> >>>>> As a starting point, what language options do I set in my YAML
>>> metadata
>>> >>>>> to enable those other two language environments, and how do I
>>> specify the
>>> >>>>> fonts for them?
>>> >>>>>
>>> >>>>> Here's my YAML metadata file so far:
>>> >>>>>
>>> >>>>> ---
>>> >>>>>    author: Lyndon Drake
>>> >>>>>    documentclass: memoir
>>> >>>>>    toc: true
>>> >>>>>    papersize: a4
>>> >>>>>    fontsize: 12pt
>>> >>>>>    top-level-division: chapter
>>> >>>>>    number-sections: true
>>> >>>>>    mainfont: Skolar PE Light
>>> >>>>>    mainfontoptions: Numbers=OldStyle
>>> >>>>>    bibliography: /Users/lyndon/Documents/Media/Bibliography/0lib.bib
>>>
>>> >>>>>    csl:
>>> >>>>> /Users/lyndon/Documents/Media/Bibliography/society-of-biblic
>>> al-literature-fullnote-bibliography.csl
>>> >>>>>    notes-after-punctuation: true
>>> >>>>> ---
>>> >>>>>
>>> >>>>> Many thanks in advance for any help on this,
>>> >>>>> Lyndon
>>> >>>>>
>>> >>>>> --
>>> >>>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> >>>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> >>>>
>>> >>>>
>>> >>>>> To view this discussion on the web visit
>>> >>>>> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f8
>>> 83-4853-a97f-a81861395b78%40googlegroups.com
>>> >>>>> <https://groups.google.com/d/msgid/pandoc-discuss/89122680-f
>>> 883-4853-a97f-a81861395b78%40googlegroups.com?utm_medium=ema
>>> il&utm_source=footer>
>>> >>>>> .
>>> >>>>> For more options, visit https://groups.google.com/d/optout.
>>> >>>>>
>>> >>>> --
>>> >>> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
>>> >>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>>> >>> <javascript:>.
>>> >>> To view this discussion on the web visit
>>> >>> https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a
>>> 82-4a0d-8bb4-4ec2513723fe%40googlegroups.com
>>> >>> <https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3
>>> a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com?utm_medium=ema
>>> il&utm_source=footer>
>>> >>> .
>>> >>> For more options, visit https://groups.google.com/d/optout.
>>> >>>
>>> >>
>>> >
>>>
>>> --
>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/pandoc-discuss/5cd094b1-ccba-4c6c-a83b-d0fa2ebf39ba%40go
>> oglegroups.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/5cd094b1-ccba-4c6c-a83b-d0fa2ebf39ba%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
> 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/a5d78535-d049-49c9-a77b-ddfa3b226302%
> 40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/a5d78535-d049-49c9-a77b-ddfa3b226302%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CADAJKhDeJ6fWqdr36Yd1fgZLbTL6FZGVPGahNN44HoezJo69dQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 23921 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                                       ` <CADAJKhDeJ6fWqdr36Yd1fgZLbTL6FZGVPGahNN44HoezJo69dQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-06-10  8:38                                         ` Lyndon Drake
  0 siblings, 0 replies; 18+ messages in thread
From: Lyndon Drake @ 2017-06-10  8:38 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 20341 bytes --]

I reckon you can do most cases just with the direction-breaking character, 
and I've got a custom keymap with a shortcut for doing it. Because so many 
apps now implement the bidi algorithm, I can see in my text editor whether 
it's working correctly there, with some confidence that the same output 
will occur elsewhere (if the copy/paste preserves the unicode characters).

But yes, it's all much easier than in the past - thankfully I never had to 
do what you did back then!

On Friday, June 9, 2017 at 12:13:00 PM UTC+1, BP wrote:
>
> On occasion I have used some of the many Unicode bracket pairs as 
> delimiters and replaced them with the corresponding LaTeX or HTML markup by 
> regular expression or by making them active in XeLaTeX. They're minimally 
> invasive but can be a pain to type, and it taxes the memory to remember 
> which is which. I would end up defining a code snippet where I anyway would 
> type something like `..grc TEXT<tab>` and then I think I can just as well 
> have the same snippet expand to a span. It's so much less invasive now that 
> Pandoc supports bracketed spans. As always how you see things depends on 
> where you are coming from. Back in the early nineties I had to make my own 
> 8-bit fonts and do the necessary incantations to make them work with LaTeX, 
> and I wrote my own script which sorted and marked up word indexes, a must 
> have in comparative philology. In fact I still use a descendant of it; 
> things are both easier and harder with Unicode!
>
>
> Den 9 jun 2017 10:03 skrev "Lyndon Drake" <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org <javascript:>
> >:
>
>> I did once know Haskell, but these days it makes my head hurt a bit. I'll 
>> have a go later this summer once exams are out of the way. I think it's 
>> feasible (partly because I've seen it implemented elsewhere) but I could 
>> easily be wrong, in which case I'll fall back on the marked spans. Your 
>> filter does at least make them minimally invasive. I just don't like the 
>> way it clutters up the text-only view with markup, which is the number one 
>> reason I'm trying to use Markdown instead of just using LaTeX directly.
>>
>> Thanks again for the help.
>>
>> On Thursday, June 8, 2017 at 6:20:11 PM UTC+1, BP wrote:
>>>
>>> The marked spans approach suits me well as in my nook of the woods 
>>> everything but Greek and modern Cyrillic languages is usually cited in 
>>> romanization.
>>>
>>> Setting the language based on Unicode ranges with a Pandoc filter is 
>>> probably rather hard, since Pandoc splits text content into lists of 
>>> alternating Str elements, containing the non-whitespace parts, and Space 
>>> and LineBreak elements representing the whitespace parts. You will need to 
>>> locate all places in the AST where there is such a list, step through the 
>>> list looking for Str elements containing characters from one of the scripts 
>>> you are interested in and enclose sequences of alternating script character 
>>> Str elements and whitespace elements in Span elements with appropriate 
>>> attributes or raw markup elements. It is possible that this might be done 
>>> more or less efficiently with Haskell -- I don't know. If you like me don't 
>>> know Haskell it is going to be tricky. If you also want the resulting 
>>> markup to look pretty you also need to take such things as embedded 
>>> emphasis elements into consideration, not to speak of Str elements with 
>>> mixed scripts if any. I tried a poor man's substitute once, locating Greek 
>>> portions in Markdown source with a regular expression, but it was too hard 
>>> to handle punctuation sufficiently elegantly (Greek portions starting and 
>>> ending with punctuation in particular).
>>>
>>> You mentioned the ucharclasses package which may be helpful when 
>>> producing PDF. My experience is again that punctuation inside an 
>>> otherscript portion is problematic, at least if the other script uses 
>>> punctuation from general punctuation and/or ASCII, and it still leaves you 
>>> out of luck when producing HTML. It is still best practice to wrap portions 
>>> with other directionality in elements with a dir attribute, not to mention 
>>> making sure that portions in other languages are put in divs with a lang 
>>> tag, not least for the benefit of those using assistive technologies.
>>>
>>> Den 8 jun 2017 12:14 skrev "Lyndon Drake" <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>:
>>>
>>> That's very helpful, thank you!
>>>
>>> I haven't actually rewritten the LaTeX template preamble, just moved 
>>> things around a bit, retaining all the Pandoc variables but making the 
>>> package load order robust. I think I'll probably slightly update the 
>>> template, for two more things:
>>>
>>> 1. it's nice to have access to two places for header insertions, one 
>>> near the start and the other near the end of the header material once all 
>>> the packages have been loaded;
>>>
>>> 2. the memoir class works best for books when there are \frontmatter, 
>>> \mainmatter, and \endmatter calls in the document, so I will add options 
>>> and a test to allow those.
>>>
>>> I like the span syntax you've got, though in the medium term I want to 
>>> work on an automatic filter for setting the language based on Unicode 
>>> ranges and just use spans to cover unusual cases (although in fact, there 
>>> is almost no case that cannot be covered by the use of Unicode 
>>> direction-breaking marks or spaces, which have the advantage of working 
>>> without any markup in HTML in modern browsers with font fallback 
>>> mechanisms).
>>>
>>>
>>> On Wednesday, June 7, 2017 at 5:23:54 PM UTC+1, BP Jonsson wrote:
>>>>
>>>> Den 2017-06-06 kl. 15:26, skrev Lyndon Drake: 
>>>> > Thanks for this. I'd come to the conclusion that writing a latex file 
>>>> and 
>>>> > including the fragments that pandoc generates might be the way 
>>>> forward, but 
>>>> > I'm also curious to know what I've been doing wrong. 
>>>>
>>>> You don't need to write the whole preamble by hand, just the part 
>>>> where you load and configure polyglossia and define the fonts 
>>>> needed for polyglossia. 
>>>> put them in a file called for example `poly.ltx` and then run 
>>>> Pandoc with 
>>>>
>>>> ```` 
>>>> pandoc -H poly.ltx --latex-engine=xelatex 
>>>> ```` 
>>>>
>>>> I *think* this will also make the bidi bug go away. The 
>>>> polyglossia package loads the bidi package if needed, but bidi 
>>>> wants to be loaded after a lot of other packages which it performs 
>>>> keyhole surgery on, including longtable and even hyperref. However 
>>>> Pandoc's latex template, loads polyglossia quite early, 
>>>> alternatively to loading babel. There may be no other way to fix 
>>>> that than to use a custom template where polyglossia is loaded 
>>>> quite late, perhaps even after the header-includes, lest the 
>>>> latter also load some package which bidi wants to be loaded before 
>>>> itself. I have made such a template 
>>>> (<https://gist.github.com/bpj/5cebc975685134145cd74ca8670b1ccc>) 
>>>> If it solves the problem please let me know and I'll make a pull 
>>>> request for the change. 
>>>>
>>>> My custom template also includes my fontspec hack which lets you 
>>>> declare font families in your metadata like this: 
>>>>
>>>> ```` 
>>>> font-families: 
>>>>    - name: '\<language>font' 
>>>>      font:    <Font Name> 
>>>>      options: 
>>>>        - <key>='<value>' 
>>>>    - name: '\greekfont' 
>>>>      font:    GFS Neohellenic 
>>>>      options: 
>>>>        - Language=Greek 
>>>>        - Script=Greek 
>>>>        - Scale=MatchLowercase 
>>>>        - Ligatures=TeX 
>>>>    - name: '\sanskritfont' 
>>>>      font:    Sahadeva 
>>>>      options: 
>>>>        - Language=Sanskrit 
>>>>        - Script=Devanagari 
>>>>    - name: '\myfancyfont' 
>>>>      font: My Fancy 
>>>> ```` 
>>>>
>>>>
>>>> > 
>>>> > No rush of course, but I'm keen to have a look at your filter and see 
>>>> what 
>>>> > it does, 
>>>>
>>>> It is now documented and uploaded: 
>>>>
>>>> <https://gist.github.com/bpj/02de1ed87ff8f8d0c31a43b9dcac1c80> 
>>>>
>>>> (Scroll down for the rendered documentation. The first code block 
>>>> should suffice to understand how it works.) 
>>>>
>>>> It takes some initial configuration but that should be reusable by 
>>>> including a separate YAML file on the command line with the actual 
>>>> document. 
>>>>
>>>>
>>>>
>>>>
>>>> even without docs. I've also found another filter on the list back 
>>>> > in 2014 from Jesse Rosenthal that looks at Unicode ranges and wraps 
>>>> them in 
>>>> > a latex environment, which seems like a good idea (I've done this 
>>>> kind of 
>>>> > thing in InDesign grep styles and it works well for most normal bits 
>>>> of 
>>>> > text). 
>>>> > 
>>>> > I found the lang/otherlangs documentation, but couldn't figure out 
>>>> from the 
>>>> > manual (might just be overlooking the correct bit) how to set a div 
>>>> or a 
>>>> > span for another language. 
>>>> > 
>>>> > Part of the problem is that if I set lang and otherlangs as follows: 
>>>> > 
>>>> >    lang: en-GB 
>>>> >    otherlangs: [he, sy] 
>>>> >     
>>>> > I get this: 
>>>> > 
>>>> > ! Package bidi Error: Oops! you have loaded package longtable after 
>>>> bidi 
>>>> > packag 
>>>> > 
>>>> > e. Please load package longtable before bidi package, and then try to 
>>>> run 
>>>> > xelat 
>>>> > 
>>>> > ex on your document again. 
>>>> > 
>>>> > 
>>>> > See the bidi package documentation for explanation. 
>>>> > 
>>>> > Type  H <return>  for immediate help. 
>>>> > 
>>>> >   ... 
>>>> > 
>>>> >                                                     
>>>> > 
>>>> > l.72 \begin{document} 
>>>> > 
>>>> > 
>>>> > pandoc: Error producing PDF 
>>>> > 
>>>> > 
>>>> > which I guess means that some kind of strange interaction in the 
>>>> latex 
>>>> > template is producing an undesirable latex file to feed to xelatex 
>>>> (maybe 
>>>> > pandoc-csv2table is doing something to the produced latex?). But it 
>>>> kind of 
>>>> > put a stop to me experimenting with the spans and divs. 
>>>> > 
>>>> > Best, 
>>>> > Lyndon 
>>>> > 
>>>> > On Tuesday, June 6, 2017 at 1:08:48 PM UTC+1, BPJ wrote: 
>>>> >> 
>>>> >> You need to use the lang and otherlang variables as described in the 
>>>> >> manual http://pandoc.org/MANUAL if I recall correctly. 
>>>> >> 
>>>> >> Alternatively/additionally write a latex file containing a preamble 
>>>> >> fragment where you load polyglossia and any languages and fonts you 
>>>> need 
>>>> >> with the options you need in the usual polyglossia/fontspec way and 
>>>> include 
>>>> >> it with the -H option. You also need to mark spans/divs containing 
>>>> extra 
>>>> >> languages with lang and dir attributes as appropriate. Use your 
>>>> browser's 
>>>> >> page search function to find these terms in the manual. 
>>>> >> 
>>>> >> I saw your other question about font/language switching yesterday 
>>>> and 
>>>> >> started to write some documentation for the filter I use to make 
>>>> those 
>>>> >> things easier. Alas I couldn't finish and today there is a national 
>>>> holiday 
>>>> >> in Sweden. I'll get back to it tomorrow. Basically you can use spans 
>>>> with a 
>>>> >> single short class like .g for greek and the filter will inject 
>>>>  latex 
>>>> >> markup, docx custom style names or extended (html) attributes you 
>>>> have 
>>>> >> declared to correspond to the class in your metadata. 
>>>> >> 
>>>> >> I can comfort you that you are much better off than I was when I 
>>>> started 
>>>> >> doing multilingual work with Pandoc. We had no filters, no native 
>>>> spans or 
>>>> >> divs and no built-in multilingual/polyglossia support back then. 
>>>> Everything 
>>>> >> had to be done in -H files and with raw latex in the markdown, which 
>>>> was a 
>>>> >> pain because I needed to make things available in HTML as well. 
>>>> >> 
>>>> >> I'll also update my latex template on github which contains some 
>>>> stuff for 
>>>> >> fontspec font loading. 
>>>> >> 
>>>> >> I hope this helps. I'm afraid I won't be able to check my mail for 
>>>> the 
>>>> >> rest of the day. 
>>>> >> 
>>>> >> 
>>>> >> tis 6 juni 2017 kl. 09:02 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org 
>>>> >> <javascript:>>: 
>>>> >> 
>>>> >>> Sorry, I probably wasn't clear: I followed the instruction from 
>>>> Pandoc 
>>>> >>> and switched to xelatex. Now I'm stuck trying to configure the 
>>>> language 
>>>> >>> options. 
>>>> >>> 
>>>> >>> 
>>>> >>> On Tuesday, June 6, 2017 at 7:41:32 AM UTC+1, BP wrote: 
>>>> >>> 
>>>> >>>> You need  the --latex-engine=xelatex option. 
>>>> >>>> 
>>>> >>>> tis 6 juni 2017 kl. 07:53 skrev Lyndon Drake <lyn...-S8RYeTzMgQ3QT0dZR+AlfA@public.gmane.org>: 
>>>> >>>> 
>>>> >>> Hi all, 
>>>> >>>>> 
>>>> >>>>> Many apologies as I'm sure this is all obvious once one knows, 
>>>> but I'm 
>>>> >>>>> a bit stuck. I've got some Pandoc Markdown files which I'm trying 
>>>> to 
>>>> >>>>> convert to PDF using Pandoc. They include various non-ascii 
>>>> characters, all 
>>>> >>>>> in unicode. If I run: 
>>>> >>>>> 
>>>> >>>>> /usr/local/bin/pandoc -f 
>>>> >>>>> markdown+pipe_tables+grid_tables+yaml_metadata_block --filter 
>>>> >>>>> pandoc-citeproc --filter pandoc-csv2table -s -o 
>>>> formatted/Draft3.pdf 
>>>> >>>>> text/metadata.yaml text/1-Introduction.md 
>>>> >>>>> 
>>>> >>>>> I get the following: 
>>>> >>>>> 
>>>> >>>>> ! Package inputenc Error: Unicode char ṣ (U+1E63) 
>>>> >>>>> 
>>>> >>>>> (inputenc)                not set up for use with LaTeX. 
>>>> >>>>> 
>>>> >>>>> 
>>>> >>>>> See the inputenc package documentation for explanation. 
>>>> >>>>> 
>>>> >>>>> Type  H <return>  for immediate help. 
>>>> >>>>> 
>>>> >>>>>   ... 
>>>> >>>>> 
>>>> >>>>>                                                     
>>>> >>>>> 
>>>> >>>>> l.125   Vandenhoeck \& Ruprecht, 1990), 39--62.} 
>>>> >>>>> 
>>>> >>>>> 
>>>> >>>>> Try running pandoc with --latex-engine=xelatex. 
>>>> >>>>> 
>>>> >>>>> pandoc: Error producing PDF 
>>>> >>>>> 
>>>> >>>>> 
>>>> >>>>> So the next step was to switch to xelatex based on the helpful 
>>>> >>>>> suggestion from pandoc. As long as I don't try to use any babel 
>>>> or 
>>>> >>>>> polyglossia environments, or biblatex, this works fine. But as I 
>>>> want to 
>>>> >>>>> use both, I'm a bit stuck. First thing is that it looks like the 
>>>> default 
>>>> >>>>> template tries to use babel rather than polyglossia if xetex is 
>>>> the engine. 
>>>> >>>>> Is there a reason for this? (I want to use the biblatex-sbl style 
>>>> for my 
>>>> >>>>> bibliography, and they recommend polyglossia.) 
>>>> >>>>> 
>>>> >>>>> I want to use English (UK) as my main language, with Hebrew and 
>>>> Syriac 
>>>> >>>>> as other languages (I've also got some ancient Greek, but the 
>>>> main font 
>>>> >>>>> I've chosen works fine and the output looks good for that without 
>>>> using a 
>>>> >>>>> separate language environment). 
>>>> >>>>> 
>>>> >>>>> As a starting point, what language options do I set in my YAML 
>>>> metadata 
>>>> >>>>> to enable those other two language environments, and how do I 
>>>> specify the 
>>>> >>>>> fonts for them? 
>>>> >>>>> 
>>>> >>>>> Here's my YAML metadata file so far: 
>>>> >>>>> 
>>>> >>>>> --- 
>>>> >>>>>    author: Lyndon Drake 
>>>> >>>>>    documentclass: memoir 
>>>> >>>>>    toc: true 
>>>> >>>>>    papersize: a4 
>>>> >>>>>    fontsize: 12pt 
>>>> >>>>>    top-level-division: chapter 
>>>> >>>>>    number-sections: true 
>>>> >>>>>    mainfont: Skolar PE Light 
>>>> >>>>>    mainfontoptions: Numbers=OldStyle 
>>>> >>>>>    bibliography: 
>>>> /Users/lyndon/Documents/Media/Bibliography/0lib.bib 
>>>> >>>>>    csl: 
>>>> >>>>> 
>>>> /Users/lyndon/Documents/Media/Bibliography/society-of-biblical-literature-fullnote-bibliography.csl 
>>>>
>>>> >>>>>    notes-after-punctuation: true 
>>>> >>>>> --- 
>>>> >>>>> 
>>>> >>>>> Many thanks in advance for any help on this, 
>>>> >>>>> Lyndon 
>>>> >>>>> 
>>>> >>>>> -- 
>>>> >>>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
>>>> >>>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. 
>>>>
>>>> >>>> 
>>>> >>>> 
>>>> >>>>> To view this discussion on the web visit 
>>>> >>>>> 
>>>> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com 
>>>> >>>>> <
>>>> https://groups.google.com/d/msgid/pandoc-discuss/89122680-f883-4853-a97f-a81861395b78%40googlegroups.com?utm_medium=email&utm_source=footer> 
>>>>
>>>> >>>>> . 
>>>> >>>>> For more options, visit https://groups.google.com/d/optout. 
>>>> >>>>> 
>>>> >>>> -- 
>>>> >>> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
>>>> >>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
>>>> >>> <javascript:>. 
>>>> >>> To view this discussion on the web visit 
>>>> >>> 
>>>> https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com 
>>>> >>> <
>>>> https://groups.google.com/d/msgid/pandoc-discuss/99f9330e-3a82-4a0d-8bb4-4ec2513723fe%40googlegroups.com?utm_medium=email&utm_source=footer> 
>>>>
>>>> >>> . 
>>>> >>> For more options, visit https://groups.google.com/d/optout. 
>>>> >>> 
>>>> >> 
>>>> > 
>>>>
>>>> -- 
>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/pandoc-discuss/5cd094b1-ccba-4c6c-a83b-d0fa2ebf39ba%40googlegroups.com 
>>> <https://groups.google.com/d/msgid/pandoc-discuss/5cd094b1-ccba-4c6c-a83b-d0fa2ebf39ba%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> -- 
>> 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/a5d78535-d049-49c9-a77b-ddfa3b226302%40googlegroups.com 
>> <https://groups.google.com/d/msgid/pandoc-discuss/a5d78535-d049-49c9-a77b-ddfa3b226302%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/abcf4c23-e7ac-4eea-b214-6d5bb1a53019%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 28986 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                         ` <2a8d8b0d-2740-4dfb-8718-f06432d6425f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2017-06-06 21:03                           ` Lyndon Drake
@ 2017-06-11  8:43                           ` John MacFarlane
       [not found]                             ` <20170611084305.GD95963-l/d5Ua9yGnxXsXJlQylH7w@public.gmane.org>
  1 sibling, 1 reply; 18+ messages in thread
From: John MacFarlane @ 2017-06-11  8:43 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

If you've got a change to the default latex template that
seems to work better and doesn't cause problems, I suggest
you open a pull request on the jgm/pandoc repository on
github.

We can solicit comments there from some of the people who
have contributed a lot to the LaTeX templates, to see if
they can spot any problems.

+++ Lyndon Drake [Jun 06 17 13:51 ]:
>   I've got a fair way with this. Thanks to all for the help so far.
>   1. By reading through the template, I figured out which variables to
>   define to control the LaTeX output. I'm seriously impressed with
>   Pandoc's setup - I remember the awful pain of doing a LaTeX document
>   from scratch and this gets things started so well. Thank you John &
>   everyone else!
>   2. As suggested by Joost, I shifted the package load order around,
>   retaining all the conditionals and variables in the template. I've now
>   got something which is only different by some reordering from the
>   default template, but which avoids the longtable/bidi conflict. Thanks
>   Joost!
>   I've also been playing around with a couple of filters, based on code
>   from Jesse Rosenthal on this list a few years back. It sort of works,
>   but not well enough to rely on. For the moment, I'm just going to tag
>   every word and block with div/span.
>   It did also occur to me that the proper place to do this stuff is
>   actually in LaTeX, not Pandoc. E.g. I'm going to use biblatex, and I'd
>   want the same rules applied to the output from biblatex. There's a
>   package:
>   https://github.com/Pomax/ucharclasses
>   which does some of this. One way to do it would be to implement the
>   Unicode bidi algorithm http://unicode.org/reports/tr9/ (+ some sensible
>   font switching, which is actually easier than the bidi algorithm) as a
>   LaTeX package, but that's a bit much for my current document. I might
>   have a look at ways to do this properly in July & August though, as I'd
>   like to have it available before I start my thesis.
>   Anyway for the moment I'm pleased that I could get this far:
>   https://www.dropbox.com/s/aeyvkjrox5dwtpz/Screenshot%202017-06-06%2021.
>   37.41.png?dl=0
>   without having to type anything other than plain Pandoc Markdown into
>   some text & csv files, and all the formatting has been done by Pandoc
>   and some config. The thing that made me want to use Pandoc was the
>   memory of my previous thesis (in computer science) where the markup
>   made the document so cluttered I found it almost impossible to actually
>   read the text in the editor. This is promising enough that I'm going to
>   persevere to get a setup that will work for the upcoming thesis.
>   Best,
>   Lyndon
>   PS: in case it's of use to others, the relevant bits of YAML:
>     header-includes:
>       - \newfontfamily\hebrewfont{Taamey David CLM}
>       - \newfontfamily\syriacfont{Serto Jerusalem}
>     lang: en-GB
>     otherlangs: [he, syr]
>   On Tuesday, June 6, 2017 at 5:26:21 PM UTC+1, Joost wrote:
>
>     On Tue, Jun 06 2017, Lyndon Drake wrote:
>     > Part of the problem is that if I set lang and otherlangs as
>     > follows:
>     >
>     >   lang: en-GB
>     >   otherlangs: [he, sy]
>     >
>     > I get this:
>     >
>     > ! Package bidi Error: Oops! you have loaded package longtable
>     > after bidi
>     > packag
>     >
>     > e. Please load package longtable before bidi package, and then
>     > try to run
>     > xelatex on your document again.
>     >
>     >
>     > which I guess means that some kind of strange interaction in the
>     > latex
>     > template is producing an undesirable latex file to feed to
>     > xelatex (maybe
>     > pandoc-csv2table is doing something to the produced latex?).
>     No, the template is structured in such a way that polyglossia is
>     loaded before longtable, but polyglossia loads bidi in order to
>     deal with RTL languages such as Syriac.
>     I think your best bet would be to modify the default template and
>     load the other languages somewhere toward the end of the preamble,
>     after longtable and any other packages are loaded. But you'll need
>     to know some LaTeX and understand how Pandoc's template language
>     works in order to do that.
>     In actual fact, though, this may be something John needs to think
>     about, because the default LaTeX template obviously has a problem
>     here.
>     HTH
>     --
>     Joost Kremers
>     Life has its moments
>
>   --
>   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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To post to this group, send email to
>   [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To view this discussion on the web visit
>   [3]https://groups.google.com/d/msgid/pandoc-discuss/2a8d8b0d-2740-4dfb-
>   8718-f06432d6425f%40googlegroups.com.
>   For more options, visit [4]https://groups.google.com/d/optout.
>
>References
>
>   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   3. https://groups.google.com/d/msgid/pandoc-discuss/2a8d8b0d-2740-4dfb-8718-f06432d6425f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>   4. https://groups.google.com/d/optout


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Going round in circles with latex output
       [not found]                             ` <20170611084305.GD95963-l/d5Ua9yGnxXsXJlQylH7w@public.gmane.org>
@ 2017-06-11 13:28                               ` Lyndon Drake
  0 siblings, 0 replies; 18+ messages in thread
From: Lyndon Drake @ 2017-06-11 13:28 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 6882 bytes --]

Will do. I won't be for a few days as I have a writing deadline, but I'll 
do it after that. (I'm also trying to figure out another problem regarding 
footnotes and bidi that might be to do with the package load order. Bidi 
seems to cause quite a few of these kinds of problems! If I get a solution 
on that and it makes sense for the default template I'll see if that can go 
in too.)

On Sunday, June 11, 2017 at 9:43:20 AM UTC+1, John MacFarlane wrote:
>
> If you've got a change to the default latex template that 
> seems to work better and doesn't cause problems, I suggest 
> you open a pull request on the jgm/pandoc repository on 
> github. 
>
> We can solicit comments there from some of the people who 
> have contributed a lot to the LaTeX templates, to see if 
> they can spot any problems. 
>
> +++ Lyndon Drake [Jun 06 17 13:51 ]: 
> >   I've got a fair way with this. Thanks to all for the help so far. 
> >   1. By reading through the template, I figured out which variables to 
> >   define to control the LaTeX output. I'm seriously impressed with 
> >   Pandoc's setup - I remember the awful pain of doing a LaTeX document 
> >   from scratch and this gets things started so well. Thank you John & 
> >   everyone else! 
> >   2. As suggested by Joost, I shifted the package load order around, 
> >   retaining all the conditionals and variables in the template. I've now 
> >   got something which is only different by some reordering from the 
> >   default template, but which avoids the longtable/bidi conflict. Thanks 
> >   Joost! 
> >   I've also been playing around with a couple of filters, based on code 
> >   from Jesse Rosenthal on this list a few years back. It sort of works, 
> >   but not well enough to rely on. For the moment, I'm just going to tag 
> >   every word and block with div/span. 
> >   It did also occur to me that the proper place to do this stuff is 
> >   actually in LaTeX, not Pandoc. E.g. I'm going to use biblatex, and I'd 
> >   want the same rules applied to the output from biblatex. There's a 
> >   package: 
> >   https://github.com/Pomax/ucharclasses 
> >   which does some of this. One way to do it would be to implement the 
> >   Unicode bidi algorithm http://unicode.org/reports/tr9/ (+ some 
> sensible 
> >   font switching, which is actually easier than the bidi algorithm) as a 
> >   LaTeX package, but that's a bit much for my current document. I might 
> >   have a look at ways to do this properly in July & August though, as 
> I'd 
> >   like to have it available before I start my thesis. 
> >   Anyway for the moment I'm pleased that I could get this far: 
> >   https://www.dropbox.com/s/aeyvkjrox5dwtpz/Screenshot%202017-06-06%2021. 
>
> >   37.41.png?dl=0 
> >   without having to type anything other than plain Pandoc Markdown into 
> >   some text & csv files, and all the formatting has been done by Pandoc 
> >   and some config. The thing that made me want to use Pandoc was the 
> >   memory of my previous thesis (in computer science) where the markup 
> >   made the document so cluttered I found it almost impossible to 
> actually 
> >   read the text in the editor. This is promising enough that I'm going 
> to 
> >   persevere to get a setup that will work for the upcoming thesis. 
> >   Best, 
> >   Lyndon 
> >   PS: in case it's of use to others, the relevant bits of YAML: 
> >     header-includes: 
> >       - \newfontfamily\hebrewfont{Taamey David CLM} 
> >       - \newfontfamily\syriacfont{Serto Jerusalem} 
> >     lang: en-GB 
> >     otherlangs: [he, syr] 
> >   On Tuesday, June 6, 2017 at 5:26:21 PM UTC+1, Joost wrote: 
> > 
> >     On Tue, Jun 06 2017, Lyndon Drake wrote: 
> >     > Part of the problem is that if I set lang and otherlangs as 
> >     > follows: 
> >     > 
> >     >   lang: en-GB 
> >     >   otherlangs: [he, sy] 
> >     > 
> >     > I get this: 
> >     > 
> >     > ! Package bidi Error: Oops! you have loaded package longtable 
> >     > after bidi 
> >     > packag 
> >     > 
> >     > e. Please load package longtable before bidi package, and then 
> >     > try to run 
> >     > xelatex on your document again. 
> >     > 
> >     > 
> >     > which I guess means that some kind of strange interaction in the 
> >     > latex 
> >     > template is producing an undesirable latex file to feed to 
> >     > xelatex (maybe 
> >     > pandoc-csv2table is doing something to the produced latex?). 
> >     No, the template is structured in such a way that polyglossia is 
> >     loaded before longtable, but polyglossia loads bidi in order to 
> >     deal with RTL languages such as Syriac. 
> >     I think your best bet would be to modify the default template and 
> >     load the other languages somewhere toward the end of the preamble, 
> >     after longtable and any other packages are loaded. But you'll need 
> >     to know some LaTeX and understand how Pandoc's template language 
> >     works in order to do that. 
> >     In actual fact, though, this may be something John needs to think 
> >     about, because the default LaTeX template obviously has a problem 
> >     here. 
> >     HTH 
> >     -- 
> >     Joost Kremers 
> >     Life has its moments 
> > 
> >   -- 
> >   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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >   To post to this group, send email to 
> >   [2]pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >   To view this discussion on the web visit 
> >   [3]
> https://groups.google.com/d/msgid/pandoc-discuss/2a8d8b0d-2740-4dfb- 
> >   8718-f06432d6425f%40googlegroups.com. 
> >   For more options, visit [4]https://groups.google.com/d/optout. 
> > 
> >References 
> > 
> >   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:> 
> >   2. mailto:pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:> 
> >   3. 
> https://groups.google.com/d/msgid/pandoc-discuss/2a8d8b0d-2740-4dfb-8718-f06432d6425f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer 
> >   4. https://groups.google.com/d/optout 
>
>

-- 
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/e99efca7-e62a-4c1d-bf99-9ce4fc91718b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 12419 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-06-11 13:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-06  5:52 Going round in circles with latex output Lyndon Drake
     [not found] ` <89122680-f883-4853-a97f-a81861395b78-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-06-06  6:41   ` Melroch
     [not found]     ` <CADAJKhD0J3JG_qqs1yz5eDORPFRFJCsefUwsGq4+taYkvn95-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-06  7:01       ` Lyndon Drake
     [not found]         ` <99f9330e-3a82-4a0d-8bb4-4ec2513723fe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-06-06 12:08           ` BPJ
     [not found]             ` <CADAJKhAMLTJrfZG28bac8X+Sj589=vqJ18WswEax=1iEukafgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-06 13:26               ` Lyndon Drake
     [not found]                 ` <e028cdb2-2ace-4a13-8a13-3c2858f002b1-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-06-06 16:26                   ` Joost Kremers
     [not found]                     ` <87d1ah84m4.fsf-97jfqw80gc6171pxa8y+qA@public.gmane.org>
2017-06-06 20:51                       ` Lyndon Drake
     [not found]                         ` <2a8d8b0d-2740-4dfb-8718-f06432d6425f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-06-06 21:03                           ` Lyndon Drake
2017-06-11  8:43                           ` John MacFarlane
     [not found]                             ` <20170611084305.GD95963-l/d5Ua9yGnxXsXJlQylH7w@public.gmane.org>
2017-06-11 13:28                               ` Lyndon Drake
2017-06-07 16:23                   ` BP Jonsson
     [not found]                     ` <ad97e931-ac10-0204-d03e-c646e32e4ba1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-08 10:13                       ` Lyndon Drake
     [not found]                         ` <CADAJKhBNwTRaK=Htarn-YzJfCSVCeN5C-z46XBArgW1J6R3RYA@mail.gmail.com>
     [not found]                           ` <CADAJKhBNwTRaK=Htarn-YzJfCSVCeN5C-z46XBArgW1J6R3RYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-08 17:20                             ` Melroch
     [not found]                               ` <CADAJKhD=6C2Zz0J3u2jB_7XyX+4+b4ui1bTr6wTG5kSVDHbYaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-09  8:02                                 ` Lyndon Drake
     [not found]                                   ` <a5d78535-d049-49c9-a77b-ddfa3b226302-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-06-09 11:12                                     ` Melroch
     [not found]                                       ` <CADAJKhDeJ6fWqdr36Yd1fgZLbTL6FZGVPGahNN44HoezJo69dQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-10  8:38                                         ` Lyndon Drake
2017-06-07  5:43   ` iandol
     [not found]     ` <9105b544-18e3-4f40-be43-fb04c838b4de-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-06-07  8:35       ` Lyndon Drake

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).