public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Rainer M Krug <Rainer-vfylz/Ys1k4@public.gmane.org>
To: John MacFarlane <public-jgm-TVLZxgkOlNX2fBVCVOL8/A@plane.gmane.org>
Cc: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: siunitx package support in pandoc (filter for \num \numlist \numrange \si and \SI?
Date: Mon, 30 Nov 2015 13:30:59 +0100	[thread overview]
Message-ID: <m27fkzfz3w.fsf@krugs.de> (raw)
In-Reply-To: <20151127194646.GB49129-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org> (John MacFarlane's message of "Fri, 27 Nov 2015 11:46:46 -0800")

[-- 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

      parent reply	other threads:[~2015-11-30 12:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 14:47 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 message]

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=m27fkzfz3w.fsf@krugs.de \
    --to=rainer-vfylz/ys1k4@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=public-jgm-TVLZxgkOlNX2fBVCVOL8/A@plane.gmane.org \
    /path/to/YOUR_REPLY

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

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