emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: interaction between org-latex-custom-lang-environments and name when exporting to latex
Date: Fri, 27 Nov 2015 22:05:33 +0100	[thread overview]
Message-ID: <87h9k740gy.fsf@gmx.us> (raw)
In-Reply-To: m2egfbif18.fsf@wifi-eduroam-161006.inria.fr

Hi Alan,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

>> Nitpick: label should be inside caption in the example to be consistent
>> with how captions are normally formatted by ox-latex.  Either way is fine
>> though.
>
> I chose this example because it's the code in the minted manual.

As you prefer.

>> Also, you need to denote that the defcustom was changed.
>>
>>   :version "25.1"
>>   :package-version '(Org . "9.0")
>>
>> When you are at it, please add the missing tags, :group and :type.
>
> It's not a defcustom but a defvar. (But maybe it should be a defcustom …)

It should be a defcustom.  Feel free to fix it, preferably in a separate
patch.

    11.5 Defining Global Variables
    A [defvar/defconst] definition is a construct that announces your
    intention to use a symbol as a global variable.
    ...
    To define a customizable variable, you should use defcustom (which
    calls defvar as a subroutine). See Variable Definitions.

> From 527635c2e674fe1f3ab9d5d3de96e238d0debf7b Mon Sep 17 00:00:00 2001
> From: Alan Schmitt <alan.schmitt@polytechnique.org>
> Date: Wed, 25 Nov 2015 08:48:58 +0100
> Subject: [PATCH] ox-latex: Extend custom-lang-environments
>
> * ox-latex.el (org-latex-custom-lang-environments): Extend the
>   documentation string.
> * ox-latex.el (org-latex-src-block): Allow a custom language environment
>   to be a format string to be directly inserted.
> ---
>  lisp/ox-latex.el | 58 ++++++++++++++++++++++++++++++++++++++++++++------------
>  1 file changed, 46 insertions(+), 12 deletions(-)
>
> diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
> index bbf7f41..0a9f7d4 100644
> --- a/lisp/ox-latex.el
> +++ b/lisp/ox-latex.el
> @@ -1025,17 +1025,44 @@ block-specific options, you may use the following syntax:
>    "Alist mapping languages to language-specific LaTeX environments.
>  
>  It is used during export of src blocks by the listings and minted
> -latex packages.  For example,
> +latex packages.  The environment may either be a simple string,

You don’t need the ’either’ IMO, but as you please. 

> +composed of only letters and numbers.  In this case, the string is
> +directly the name of the latex environment to use.  The environment
> +may also be a format string.  In this case the format string will be
> +directly exported.  This format string may contain these elements:
> +
> +  %s for the formatted source
> +  %c for the caption
> +  %f for the float attribute
> +  %l for an appropriate label 
> +
> +For example,
>  
>    (setq org-latex-custom-lang-environments
> -     '((python \"pythoncode\")))
> +     '((python \"pythoncode\")
> +       (ocaml \"\\\\begin{listing}
> +\\\\begin{minted}{ocaml}
> +%s\\\\end{minted}
> +\\\\caption{%c}
> +\\\\label{%l}\")))
>  
> -would have the effect that if org encounters begin_src python
> -during latex export it will output
> +would have the effect that if org encounters a Python source block
> +during LaTeX export it will produce
>  
>    \\begin{pythoncode}
>    <src block body>
> -  \\end{pythoncode}")
> +  \\end{pythoncode}
> +
> +and if org encounters an Ocaml source block during LaTeX export it

Org.  Perhaps the ’and’ should be capitalized.  I don’t know.

The rest looks good to me.  Feel free to push (modulus someone else saying
otherwise).

Thanks,
Rasmus

-- 
m-mm-mmm-mmmm bacon!

  reply	other threads:[~2015-11-27 21:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16 12:59 interaction between org-latex-custom-lang-environments and name when exporting to latex Alan Schmitt
2015-11-20  7:55 ` Alan Schmitt
2015-11-20 10:41   ` Rasmus
2015-11-20 11:06     ` Alan Schmitt
2015-11-23 11:13     ` Alan Schmitt
2015-11-23 17:54       ` Rasmus
2015-11-24  8:07         ` Alan Schmitt
2015-11-24 13:14           ` Rasmus
2015-11-25  7:59             ` Alan Schmitt
2015-11-25  9:57               ` Rasmus
2015-11-27 16:27                 ` Alan Schmitt
2015-11-27 21:05                   ` Rasmus [this message]
2015-11-30 12:12                     ` Alan Schmitt
2015-11-30 13:11                       ` Rasmus
2015-12-01  8:14                         ` Alan Schmitt

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=87h9k740gy.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --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).