public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* siunitx package support in pandoc (filter for \num \numlist \numrange \si and \SI?
@ 2015-11-27 14:47 Rainer M Krug
       [not found] ` <1a1d3164-378b-4a06-9509-64b361c891df-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Rainer M Krug @ 2015-11-27 14:47 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi

I am using the siunitx package in latex and use pandoc to convert the latex 
source to docx.

I am using the \num \numlist \numrange \si and \SI macros from the siunitx 
package. Tese are obviously not supported in pandoc.

Is there a filter which I could use to convert these in  numbers with units 
in in normal text? The docx is not for publication , only for the 
co-authors, so a formating of the numbers with spaces and thousand 
delimiter would be make them happier, but not necessary.

\num{1234567}                       ->   1234567
\numrange{0.1}{6.0}                 ->   0.1-6.0
\numlist{0.1; 2.5; 5.0; 5.5; 6.0}   ->   0.1, 2.5, 5.0, 5.5, 6.0

\si{R}                              ->   R
\SI{17.09}[R]{\per cell}            ->   R17.09 / cell


Is there an easy way of doing this via filter, or would be pre-processing 
of the tex file be easier?

Thanks,

Rainer

-- 
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/1a1d3164-378b-4a06-9509-64b361c891df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: siunitx package support in pandoc (filter for \num \numlist \numrange \si and \SI?
       [not found] ` <1a1d3164-378b-4a06-9509-64b361c891df-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2015-11-27 16:38   ` Melroch
       [not found]     ` <CADAJKhCrevm8GuApt=tt_Ww2a8sWefXCRhPsQBfhqg=M_A_yhQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2015-11-27 19:46   ` John MacFarlane
  1 sibling, 1 reply; 5+ messages in thread
From: Melroch @ 2015-11-27 16:38 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

It would require at least some TeX parsing in either case.
If all the needed conversions are as simple as in your example it should be
feasible with a filter.

Since this is not for publication, are your coauthors LaTeX literate at
all? If they would be able to understand the raw latex it would be trivial
to turn it into Code elements which will be readable in the the docx.

/bpj
Den 27 nov 2015 15:47 skrev "Rainer M Krug" <r.m.krug-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:

> Hi
>
> I am using the siunitx package in latex and use pandoc to convert the
> latex source to docx.
>
> I am using the \num \numlist \numrange \si and \SI macros from the siunitx
> package. Tese are obviously not supported in pandoc.
>
> Is there a filter which I could use to convert these in  numbers with
> units in in normal text? The docx is not for publication , only for the
> co-authors, so a formating of the numbers with spaces and thousand
> delimiter would be make them happier, but not necessary.
>
> \num{1234567}                       ->   1234567
> \numrange{0.1}{6.0}                 ->   0.1-6.0
> \numlist{0.1; 2.5; 5.0; 5.5; 6.0}   ->   0.1, 2.5, 5.0, 5.5, 6.0
>
> \si{R}                              ->   R
> \SI{17.09}[R]{\per cell}            ->   R17.09 / cell
>
>
> Is there an easy way of doing this via filter, or would be pre-processing
> of the tex file be easier?
>
> Thanks,
>
> Rainer
>
> --
> 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/1a1d3164-378b-4a06-9509-64b361c891df%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/1a1d3164-378b-4a06-9509-64b361c891df%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/CADAJKhCrevm8GuApt%3Dtt_Ww2a8sWefXCRhPsQBfhqg%3DM_A_yhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: siunitx package support in pandoc (filter for \num \numlist \numrange \si and \SI?
       [not found]     ` <CADAJKhCrevm8GuApt=tt_Ww2a8sWefXCRhPsQBfhqg=M_A_yhQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-11-27 16:47       ` Rainer M Krug
  0 siblings, 0 replies; 5+ messages in thread
From: Rainer M Krug @ 2015-11-27 16:47 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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



Envoyé de mon iPhone

> Le 27 nov. 2015 à 17:38, Melroch <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> a écrit :
> 
> It would require at least some TeX parsing in either case.
> If all the needed conversions are as simple as in your example it should be feasible with a filter.
> 
That are the only ones that I use from the package. I don't think I will use much more. 
> Since this is not for publication, are your coauthors LaTeX literate at all?
> 
Not at all - pure MS Word user - even an .odt makes them shiver. 

> If they would be able to understand the raw latex it would be trivial to turn it into Code elements which will be readable in the the docx.
> 

That could work, but not result in very happy co-authors. 

So any conversion would be the best. 

Cheers,

Rainer
> /bpj
> 
> Den 27 nov 2015 15:47 skrev "Rainer M Krug" <r.m.krug-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>> Hi
>> 
>> I am using the siunitx package in latex and use pandoc to convert the latex source to docx.
>> 
>> I am using the \num \numlist \numrange \si and \SI macros from the siunitx package. Tese are obviously not supported in pandoc.
>> 
>> Is there a filter which I could use to convert these in  numbers with units in in normal text? The docx is not for publication , only for the co-authors, so a formating of the numbers with spaces and thousand delimiter would be make them happier, but not necessary.
>> 
>> \num{1234567}                       ->   1234567
>> \numrange{0.1}{6.0}                 ->   0.1-6.0
>> \numlist{0.1; 2.5; 5.0; 5.5; 6.0}   ->   0.1, 2.5, 5.0, 5.5, 6.0
>> 
>> \si{R}                              ->   R
>> \SI{17.09}[R]{\per cell}            ->   R17.09 / cell
>> 
>> 
>> Is there an easy way of doing this via filter, or would be pre-processing of the tex file be easier?
>> 
>> Thanks,
>> 
>> Rainer
>> -- 
>> 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/1a1d3164-378b-4a06-9509-64b361c891df%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to a topic in the Google Groups "pandoc-discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/UaeHEiCkAsQ/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CADAJKhCrevm8GuApt%3Dtt_Ww2a8sWefXCRhPsQBfhqg%3DM_A_yhQ%40mail.gmail.com.
> 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/46D02390-B6FB-4042-BE64-6F396F2DC2CE%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: siunitx package support in pandoc (filter for \num \numlist \numrange \si and \SI?
       [not found] ` <1a1d3164-378b-4a06-9509-64b361c891df-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2015-11-27 16:38   ` Melroch
@ 2015-11-27 19:46   ` John MacFarlane
       [not found]     ` <20151127194646.GB49129-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: John MacFarlane @ 2015-11-27 19:46 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

You could try putting macro definitions for these things
into your tex file (or add a small file with the macro
defs to your command line arguments).  If they are simple
(basic newcommand), pandoc will interpret them.
Example:

% pandoc -f latex -t plain
\newcommand{\num}[1]{!#1!}

\num{32}
!32!


+++ Rainer M Krug [Nov 27 15 06:47 ]:
>   Hi
>   I am using the siunitx package in latex and use pandoc to convert the
>   latex source to docx.
>   I am using the \num \numlist \numrange \si and \SI macros from the
>   siunitx package. Tese are obviously not supported in pandoc.
>   Is there a filter which I could use to convert these in  numbers with
>   units in in normal text? The docx is not for publication , only for the
>   co-authors, so a formating of the numbers with spaces and thousand
>   delimiter would be make them happier, but not necessary.
>   \num{1234567}                       ->   1234567
>   \numrange{0.1}{6.0}                 ->   0.1-6.0
>   \numlist{0.1; 2.5; 5.0; 5.5; 6.0}   ->   0.1, 2.5, 5.0, 5.5, 6.0
>   \si{R}                              ->   R
>   \SI{17.09}[R]{\per cell}            ->   R17.09 / cell
>   Is there an easy way of doing this via filter, or would be
>   pre-processing of the tex file be easier?
>   Thanks,
>   Rainer
>
>   --
>   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/1a1d3164-378b-4a06-
>   9509-64b361c891df%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/1a1d3164-378b-4a06-9509-64b361c891df-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>   4. https://groups.google.com/d/optout


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

* Re: siunitx package support in pandoc (filter for \num \numlist \numrange \si and \SI?
       [not found]     ` <20151127194646.GB49129-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
@ 2015-11-30 12:30       ` Rainer M Krug
  0 siblings, 0 replies; 5+ messages in thread
From: Rainer M Krug @ 2015-11-30 12:30 UTC (permalink / raw)
  To: John MacFarlane; +Cc: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:

> You could try putting macro definitions for these things
> into your tex file (or add a small file with the macro
> defs to your command line arguments).  If they are simple
> (basic newcommand), pandoc will interpret them.
> Example:
>
> % pandoc -f latex -t plain
> \newcommand{\num}[1]{!#1!}
>
> \num{32}
> !32!
>

Thanks - that works fine, except for the \SI macro, as it has an optional
argument(?) as the second argument. It looks as follow:

\SI{17.09}[R]{cell}            ->   R17.09 cell
\SI{10}{ha}                 ->   17.09 ha

I have no idea how I can implement the first syntax?

and that I have no idea how I can implement the %

\newcommand{\percent}{\%}

produces an error during the pandoc conversion.

Any suggestions?

Thanks,

Rainer

>
> +++ Rainer M Krug [Nov 27 15 06:47 ]:
>>   Hi
>>   I am using the siunitx package in latex and use pandoc to convert the
>>   latex source to docx.
>>   I am using the \num \numlist \numrange \si and \SI macros from the
>>   siunitx package. Tese are obviously not supported in pandoc.
>>   Is there a filter which I could use to convert these in  numbers with
>>   units in in normal text? The docx is not for publication , only for the
>>   co-authors, so a formating of the numbers with spaces and thousand
>>   delimiter would be make them happier, but not necessary.
>>   \num{1234567}                       ->   1234567
>>   \numrange{0.1}{6.0}                 ->   0.1-6.0
>>   \numlist{0.1; 2.5; 5.0; 5.5; 6.0}   ->   0.1, 2.5, 5.0, 5.5, 6.0
>>   \si{R}                              ->   R
>>   \SI{17.09}[R]{\per cell}            ->   R17.09 / cell
>>   Is there an easy way of doing this via filter, or would be
>>   pre-processing of the tex file be easier?
>>   Thanks,
>>   Rainer
>>
>>   --
>>   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-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org
>>   To post to this group, send email to
>>   [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org
>>   To view this discussion on the web visit
>>   [3]https://groups.google.com/d/msgid/pandoc-discuss/1a1d3164-378b-4a06-
>>   9509-64b361c891df%40googlegroups.com.
>>   For more options, visit [4]https://groups.google.com/d/optout.
>>
>>References
>>
>>   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org
>>   2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org
>>   3. https://groups.google.com/d/msgid/pandoc-discuss/1a1d3164-378b-4a06-9509-64b361c891df-/JYPxA39Uh5TLH3MbocFFw-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org?utm_medium=email&utm_source=footer
>>   4. https://groups.google.com/d/optout
>

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

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

end of thread, other threads:[~2015-11-30 12:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-27 14:47 siunitx package support in pandoc (filter for \num \numlist \numrange \si and \SI? Rainer M Krug
     [not found] ` <1a1d3164-378b-4a06-9509-64b361c891df-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-11-27 16:38   ` Melroch
     [not found]     ` <CADAJKhCrevm8GuApt=tt_Ww2a8sWefXCRhPsQBfhqg=M_A_yhQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-27 16:47       ` Rainer M Krug
2015-11-27 19:46   ` John MacFarlane
     [not found]     ` <20151127194646.GB49129-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
2015-11-30 12:30       ` Rainer M Krug

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