public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: "Amy de Buitléir" <amy-x92Y4IBCQKU6Cx7ujrKbww@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: images in templates
Date: Sat, 7 Jan 2023 09:18:07 -0800 (PST)	[thread overview]
Message-ID: <83ac7dc5-5669-45b9-bfcf-2ffa3b32c512n@googlegroups.com> (raw)


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

I'm writing Pandoc LaTeX and Beamer templates that need to include images 
for corporate branding. So I want to insert an includegraphics command into 
the template, using the include-before-body option, or even modifying the 
default template if necessary.

The problem is that at the time pandoc is invoked, *we don't know the path 
to the images*,
but we do know their location relative to the "user data directory" (e.g. 
/home/amy/.local/share/pandoc) and the location of the YAML defaults file.

Here's the directory structure I'm using for testing.

.
├── example.md
└── templates
    └── defaults                  <-- Ultimately this will live in the user 
data directory
        ├── test.yaml
        ├── body-include.tex      <-- Contains "\includegraphics{test.png}"
        ├── header-include.tex    <-- Contains "\usepackage{graphicx}"
        └── test.png

I have tried two approaches.

1. Using --resource-path. This option can be used to specify locations to 
look for images. That works fine for images that are included in the main 
document, but not for images included in the template.

2. Passing some location information to body-include.tex (or the default 
template if I need to modify that), so it can construct a path to the 
image. The only way I know of to accomplish this is to use ${.}, but that 
only works in fields that expect file paths, not in variables that LaTeX or 
Beamer templates can use, as far as I know.

-- 
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/83ac7dc5-5669-45b9-bfcf-2ffa3b32c512n%40googlegroups.com.

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

             reply	other threads:[~2023-01-07 17:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-07 17:18 Amy de Buitléir [this message]
     [not found] ` <83ac7dc5-5669-45b9-bfcf-2ffa3b32c512n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-01-08 15:17   ` Amy de Buitléir

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=83ac7dc5-5669-45b9-bfcf-2ffa3b32c512n@googlegroups.com \
    --to=amy-x92y4ibcqku6cx7ujrkbww@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

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

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