emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: emacs-orgmode@gnu.org
Subject: Re: Templating of PDF export
Date: Mon, 03 Feb 2020 07:48:26 -0500	[thread overview]
Message-ID: <m21rrbbzvr.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <899dd194-c042-47c9-a202-bc308a1f15ac@xgm.de>

I don't know of a nice Jinja like template for this.

I think what you need is a custom exporter. You can define template
function that is responsible for the latex source. In this function you
would check for the attachment, scale it as you want, and insert the
figure code in the latex source where you want it.

I have defined a template function for a memo that you might find some
inspiration from, you can see it at.

https://github.com/jkitchin/scimax/blob/master/ox-cmu/ox-cmu-memo.el

I guess somewhere around line 91 is where you would put the code to
insert attachments.

Yours might be quite a bit simpler if you don't need file keywords for
information.

Now that I am looking at this, you could use something like s-format or
mustache to get a reasonable template. I just used concat for the most
part. The trick would be finding the template system where escaping
characters wasn't too tedious, you already have to escape some things in
the template.



Florian Lindner <mailinglists@xgm.de> writes:

> Hello,
>
> I am collecting my cooking recipes in an org-mode file. While that
> certainly works for, I would like to have a nice LaTeX export for
> non-nerd mortals to look at. All recipes are in one file and each one
> looks like:
>
> * Pancakes
> ** Ingredients
> + 6 Eggs
> + 3 Apples
> ** Directions
> Just do it!
> ** Source
> My mother
>
> Sometimes I take a photo of the meal and ATTACH it.
>
> Most guides how to customize org export are about modifying the document
> class and latex snippets there there. However, the basic association
> with * Pancakes -> \section, ** Ingredients -> \subsection stays the same.
>
> Is there something builtin org-mode which allows to use a templating
> language that allows for a more freely combination of elements, similar
> to Jinja or alike?
>
> For example, I want to embed the attachment in the export, appropriately
> scaled and nicely placed and have a line break after each recipe.
>
> I know about org-chef, but AFAIK it's more about importing templates
> from websites, not about a nice export.
>
> Any ideas for that?
>
> Thanks!
> Florian


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

      reply	other threads:[~2020-02-03 12:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-02  9:54 Templating of PDF export Florian Lindner
2020-02-03 12:48 ` John Kitchin [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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=m21rrbbzvr.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).