From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Templating of PDF export Date: Mon, 03 Feb 2020 07:48:26 -0500 Message-ID: References: <899dd194-c042-47c9-a202-bc308a1f15ac@xgm.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:33520) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyb9S-0002Vk-F9 for emacs-orgmode@gnu.org; Mon, 03 Feb 2020 07:48:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iyb9R-0003CA-86 for emacs-orgmode@gnu.org; Mon, 03 Feb 2020 07:48:30 -0500 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]:35966) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iyb9R-0003Bw-2C for emacs-orgmode@gnu.org; Mon, 03 Feb 2020 07:48:29 -0500 Received: by mail-qv1-xf2e.google.com with SMTP id db9so6710645qvb.3 for ; Mon, 03 Feb 2020 04:48:29 -0800 (PST) Received: from Johns-MacBook-Air.local (c-67-171-67-30.hsd1.pa.comcast.net. [67.171.67.30]) by smtp.gmail.com with ESMTPSA id o17sm9678508qtq.93.2020.02.03.04.48.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2020 04:48:27 -0800 (PST) In-reply-to: <899dd194-c042-47c9-a202-bc308a1f15ac@xgm.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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 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