public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* images in templates
@ 2023-01-07 17:18 Amy de Buitléir
       [not found] ` <83ac7dc5-5669-45b9-bfcf-2ffa3b32c512n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Amy de Buitléir @ 2023-01-07 17:18 UTC (permalink / raw)
  To: pandoc-discuss


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

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

* Re: images in templates
       [not found] ` <83ac7dc5-5669-45b9-bfcf-2ffa3b32c512n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-01-08 15:17   ` Amy de Buitléir
  0 siblings, 0 replies; 2+ messages in thread
From: Amy de Buitléir @ 2023-01-08 15:17 UTC (permalink / raw)
  To: pandoc-discuss


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

Apparently this is an open issue <https://github.com/jgm/pandoc/issues/6519>
.

On Saturday, 7 January 2023 at 17:18:07 UTC Amy de Buitléir wrote:

> 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/26856790-deed-4cd4-8862-181c6b74cafdn%40googlegroups.com.

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

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

end of thread, other threads:[~2023-01-08 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 17:18 images in templates Amy de Buitléir
     [not found] ` <83ac7dc5-5669-45b9-bfcf-2ffa3b32c512n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-01-08 15:17   ` Amy de Buitléir

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