emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Latex export: setting options for packages included by default
@ 2020-01-23 14:13 Jarmo Hurri
  2020-01-23 19:01 ` John Kitchin
  0 siblings, 1 reply; 2+ messages in thread
From: Jarmo Hurri @ 2020-01-23 14:13 UTC (permalink / raw)
  To: emacs-orgmode


Greetings.

When I export to Latex, org automatically creates the following line in
preamble:

\usepackage{color}

I would like to find a way to pass option [monochrome] to this
package. Adding another \usepackage creates a conflict. My preferred way
would be to add the line

\PassOptionsToPackage{monochrome}{color}

to the preamble before \usepackage.

1. Is there a way to do this (easily) in Org? I think it is possible to
   redefine the preamble template, but that would be an overkill.

2. If there is no direct option for this, could we have one? Like
   #+latex_header but which would be applied before any packages are
   loaded?

Jarmo

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

* Re: Latex export: setting options for packages included by default
  2020-01-23 14:13 Latex export: setting options for packages included by default Jarmo Hurri
@ 2020-01-23 19:01 ` John Kitchin
  0 siblings, 0 replies; 2+ messages in thread
From: John Kitchin @ 2020-01-23 19:01 UTC (permalink / raw)
  To: emacs-orgmode

Is this package listed in org-latex-default-packages-alist?

If so, you might try something like:

#+BEGIN_SRC emacs-lisp
(let ((org-latex-default-packages-alist org-latex-default-packages-alist))
  (setf (nth (seq-position org-latex-default-packages-alist "color"
			   (lambda (a b) (string= b (nth 1 a))))
	     org-latex-default-packages-alist)
	'("monochrome" "color" nil))
  (org-latex-export-to-pdf))
#+END_SRC

I think that would be a temporary modification just for the export.

Alternatively, you might define a new latex class like this:

(add-to-list 'org-latex-classes
	     '("article-monochrome"
	       "\\documentclass{article}
\\PassOptionsToPackage{monochrome}{color}
 [DEFAULT-PACKAGES]
 [PACKAGES]
 [EXTRA]"
	       ("\\section{%s}" . "\\section*{%s}")
	       ("\\subsection{%s}" . "\\subsection*{%s}")
	       ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
	       ("\\paragraph{%s}" . "\\paragraph*{%s}")
	       ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

and then specify #+LATEX_CLASS: article-monochrome in the org-file.

Jarmo Hurri <jarmo.hurri@iki.fi> writes:

> Greetings.
>
> When I export to Latex, org automatically creates the following line in
> preamble:
>
> \usepackage{color}
>
> I would like to find a way to pass option [monochrome] to this
> package. Adding another \usepackage creates a conflict. My preferred way
> would be to add the line
>
> \PassOptionsToPackage{monochrome}{color}
>
> to the preamble before \usepackage.
>
> 1. Is there a way to do this (easily) in Org? I think it is possible to
>    redefine the preamble template, but that would be an overkill.
>
> 2. If there is no direct option for this, could we have one? Like
>    #+latex_header but which would be applied before any packages are
>    loaded?
>
> Jarmo


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

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

end of thread, other threads:[~2020-01-23 19:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-23 14:13 Latex export: setting options for packages included by default Jarmo Hurri
2020-01-23 19:01 ` John Kitchin

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