From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/22747 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: ivo welch Newsgroups: gmane.text.pandoc Subject: Re: including '\usepackage{abc}` via command line option Date: Fri, 17 May 2019 12:49:16 -0700 (PDT) Message-ID: References: <674a937f-d17b-4c83-b293-e2163e089146@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1117_312565850.1558122556926" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="140522"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDAYZXVP5MLBBPVA7TTAKGQEP2BKP6I-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri May 17 21:49:21 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-ot1-f63.google.com ([209.85.210.63]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hRir2-000aPv-7X for gtp-pandoc-discuss@m.gmane.org; Fri, 17 May 2019 21:49:21 +0200 Original-Received: by mail-ot1-f63.google.com with SMTP id v16sf3855660otp.17 for ; Fri, 17 May 2019 12:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=LK49S9EqnxBrhUw75DZ4ggjxpjYJjDcJhaHYgit2fjk=; b=GqxxVz0Um78ylZC2tfQfrFpJcnyTJzforDxTrsv2V9XAcFB3UMw8p6gF41BdgoDpIt Q2PNKSAvV95ZtiISJ8ZBIDwEiOAZ1oXg2GMVz3mkxdj1wqjjf9r5Eupk6LPbT+731sPB A9pA/6+zp3+YreV4swmmTZZsgD98jXlxfqvCHk9GsXdcB60YaWMigsMYwxnqlwLGYwXf bAgRWkwWhb7anHrsKIQQ3oBTwbmKmrEfCZgrvSi00fTvPju57XiCETg+XKQR84NOCU7m g6yRfKW14SOAJ5/5neyKpOyF+ju81POdAnMK+NvGhZtbZf5YdWDFNX3tGUagXFKo3XpT tuqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=LK49S9EqnxBrhUw75DZ4ggjxpjYJjDcJhaHYgit2fjk=; b=U/zlem0DILuxtrPV+gRt1L1hBmWHJ+Rwg5s1asOZ1iQPpWBZA5eDqoncuCQ5PFbSEe 7uX/aG66meG5XnJsfp6i8c6LpvC0QcUyg1P4phQGLz9lQ65ud/9Hy400lLSGa0C7JPRW n9TWjnrXWEjfzL03V2XdHjI4kqSUq4tX5HG8BaIfTBDfje4RN0WCCJ1lFrnEO+OeEoBf sONnxTwu3z7nh0Y9lJ2HLuWrh3BLFj290cg4MM1VLakrz2NDJw4bLOhtrQIU7IlukFCM Li3++hsQC7EyldSOkXq5HDQjrVL/WdP3YETNd0+guY65r1ZSOq9+jl48YFGf6rV5eefx MKhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=LK49S9EqnxBrhUw75DZ4ggjxpjYJjDcJhaHYgit2fjk=; b=NguWI34Y04nN5MH9OCdiwySXphRm9RSZgx3aLltDMuFlIeOczqDaG8EnJNmyZ5t5lz /ejSwGJWG1uSCFMsTG4403P0Jm/EOg9ALyxY9bX/OP93qcgIdDTDstbNKea5PJC8tjb2 KPg4L85xEJK0uwam4DFORufZb78EpluhV7aYESK9Z+J40UuR9YdcQrirgTPnwnk4mFud X94vUifrHrnLwhwGeVnxhoe7okIcNth19mO2FRu2vK27RAyJU8cIcRKXI4ZJrj3xbOX0 uDEBgJYnGU1wPfQYRTvrti/TIDQq/RStmK8cZBY/z8QoIt2xJ+1E+4B/d/mYRuTgPmLt TX0g== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAWBxinVnTPTz549AO9TmAFx5QNLzBGcfkIcGNOd73/TfkaafTmN EcNNZQMAAuAnBrfSlxE/4Y0= X-Google-Smtp-Source: APXvYqwCXPrV3znJt7q3UsFUPe15LR8SGLWix38etcBxD9orzyJCpLOGuT7olViC0R7ESVq2dpRhQA== X-Received: by 2002:a9d:3f62:: with SMTP id m89mr9633262otc.128.1558122558720; Fri, 17 May 2019 12:49:18 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:6345:: with SMTP id y5ls1962238otk.3.gmail; Fri, 17 May 2019 12:49:18 -0700 (PDT) X-Received: by 2002:a9d:6f97:: with SMTP id h23mr6106034otq.60.1558122557591; Fri, 17 May 2019 12:49:17 -0700 (PDT) In-Reply-To: X-Original-Sender: ivowel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:22747 Archived-At: ------=_Part_1117_312565850.1558122556926 Content-Type: multipart/alternative; boundary="----=_Part_1118_1348743872.1558122556927" ------=_Part_1118_1348743872.1558122556927 Content-Type: text/plain; charset="UTF-8" thanks. this does not work for me, because the backslash seems to be escaped: $ pandoc -s -M header-includes='\usepackage{abc}' -o sample.tex sample.md $ grep abc pandoctbl.tex \textbackslash usepackage\{abc\} On Friday, May 17, 2019 at 11:51:32 AM UTC-7, BP wrote: > > You should be able to use `-M header-includes='\usepackage{mypackage}'` > or put whatever LaTeX you want in a file and include it with `-H file.tex` > but then you can't have any header-includes in your file metadata. > > In my latex template I have something like this near the top: > > ```` > $for(use-packages)$ > if(use-packages.name)$ > \usepackage[$for(use-packages.opts)$$use-packages.opts$$sep$,$endfor$]{$ > use-packages.name$} > $else$ > \usepackage{$use-packages$} > $endif$ > $endfor$ > ```` > > (I wrote this from memory so some details may be wrong.) > > Now I can do this in my metadata: > > ```` > --- > use-packages: > - somepackage > - name: otherpackage > opts: optname > - name: thirdpackage > opts: > - firstoption > - secondoption > --- > ```` > > and on the command line I can do: > > ```` > -M use-packages=thispackage -M use-packages=thatpackage > ```` > > Also if you are converting from some format other than Pandoc's Markdown > you can use the `--metadata-file=metadata.yaml` option and use > > ```````` > header-includes: > - | > ```{=latex} > \usepackage{somepackage} > ``` > ```````` > > or custom template stuff and whatever metadata you need in that file. > > Den fre 17 maj 2019 19:29ivo welch > skrev: > >> >> [Apologies. I read the docs twice, but I could not find it. This must >> be obvious.] >> >> I want to include in latex documents a '\usepackage{abc}`, so that my >> latex runs (or pdf runs) include it (following kpsewhich, of course). I do >> not want pandoc to include the file itself and I do not want to set it in >> the yaml header. >> >> How? >> >> -- >> 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-...-/JYPxA39Uh5TLH3MbocFFw@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/674a937f-d17b-4c83-b293-e2163e089146%40googlegroups.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/d8907aaa-1e1f-4efd-9612-950b42917c33%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_1118_1348743872.1558122556927 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

thanks.=C2=A0 this does not work for me, be= cause the backslash seems to be escaped:

=C2=A0 =C2=A0 =C2=A0$ pandoc -s -M header-inclu= des=3D'\usepackage{abc}' -o sample.tex sample.md
<= font face=3D"courier new, monospace">=C2=A0 =C2=A0 =C2=A0$ grep abc pandoct= bl.tex
=C2=A0 =C2=A0= =C2=A0\textbackslash usepackage\{abc\}


On F= riday, May 17, 2019 at 11:51:32 AM UTC-7, BP wrote:
You should be able= to use `-M header-includes=3D'\usepackage{mypackage}'`
<= div dir=3D"auto">or put whatever LaTeX you want in a file and include it wi= th `-H file.tex` but then you can't have any header-includes in your fi= le metadata.

In my latex= template I have something like this near the top:
<= br>
````
$for(use-packages)$<= /div>
\usepackage[$for(use= -packages.opts)$$use-packages.opts$$sep$,$endfor$]{$use-packages.name$}
$else$
\usepackage{$use-package= s$}
$endif$
$endfor$
````

(I w= rote this from memory so some details may be wrong.)

Now I can do this in my metadata:

````
---
use-packages:
=C2=A0 - somepackag= e
=C2=A0 - name: otherpackage
=C2=A0 =C2=A0 opts: optname
=C2=A0 - name: thirdpac= kage
=C2=A0 =C2=A0 opts:
=C2= =A0 =C2=A0 =C2=A0 - firstoption
=C2=A0 =C2=A0 =C2=A0= - secondoption
---
````

and on the command line I ca= n do:

````
-M use-packages=3Dthispackage -M use-packages=3Dthatpackage
=
````

A= lso if you are converting from some format other than Pandoc's Markdown= you can use the `--metadata-file=3Dmetadata.yaml` option and use

````````
header-includes:
=C2=A0 - |
=C2=A0 =C2=A0 ```{=3Dlatex}
=C2=A0 =C2=A0 \usepac= kage{somepackage}
=C2=A0 =C2=A0 ```
````````

or custo= m template stuff and whatever metadata you need in that file.
Den fre 17 maj 2019 19:29ivo = welch <ivo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

[Apologies.=C2=A0 I read the docs twice, but = I could not find it.=C2=A0 This must be obvious.]

= I want to include in latex documents a '\usepackage{abc}`, so that my l= atex runs (or pdf runs) include it (following kpsewhich, of course).=C2=A0 = I do not want pandoc to include the file itself and I do not want to set it= in the yaml header.
=C2=A0
How?

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-...@googlegroups.com.
To post to this group, send email to pandoc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pan= doc-discuss/674a937f-d17b-4c83-b293-e2163e089146%40googlegroups.c= om.
For more options, visit https://groups.google.com= /d/optout.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/d8907aaa-1e1f-4efd-9612-950b42917c33%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_1118_1348743872.1558122556927-- ------=_Part_1117_312565850.1558122556926--