* Use custom preamble from tex file for latex export [not found] <1535a463-91fd-d085-06ee-ebd816c57ec8@housseini.me> @ 2023-02-17 8:55 ` reza 2023-02-17 10:08 ` Fraga, Eric 2023-02-17 10:30 ` Fraga, Eric 0 siblings, 2 replies; 13+ messages in thread From: reza @ 2023-02-17 8:55 UTC (permalink / raw) To: emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 436 bytes --] Hi List Normally when exporting to latex one can set org headers to control the latex class and additional packages. I have now a tex file with the corresponding latex class and packages I normally use for my documents. Is there a way to use this tex file directly in org mode, without having to adjust #+LATEX_CLASS and #+LATEX_HEADER? Maybe something like #+LATEX_PREAMBLE "my-preamble.tex" Thanks for any hints. Cheers, Reza [-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --] [-- Type: application/pgp-keys, Size: 15557 bytes --] [-- Attachment #3: OpenPGP_signature --] [-- Type: application/pgp-signature, Size: 499 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use custom preamble from tex file for latex export 2023-02-17 8:55 ` Use custom preamble from tex file for latex export reza @ 2023-02-17 10:08 ` Fraga, Eric 2023-02-17 10:28 ` Fraga, Eric 2023-02-17 10:30 ` Fraga, Eric 1 sibling, 1 reply; 13+ messages in thread From: Fraga, Eric @ 2023-02-17 10:08 UTC (permalink / raw) To: reza; +Cc: emacs-orgmode@gnu.org Maybe (untested) #+latex_header: \include(preamble) (maybe with .tex in the file name but probably not needed) -- : Eric S Fraga, with org release_9.6.1-250-ge6353d in Emacs 30.0.50 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use custom preamble from tex file for latex export 2023-02-17 10:08 ` Fraga, Eric @ 2023-02-17 10:28 ` Fraga, Eric 0 siblings, 0 replies; 13+ messages in thread From: Fraga, Eric @ 2023-02-17 10:28 UTC (permalink / raw) To: Org Mode List You probably want "input" and not "include" in my suggestion. -- : Eric S Fraga, with org release_9.6.1-250-ge6353d in Emacs 30.0.50 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use custom preamble from tex file for latex export 2023-02-17 8:55 ` Use custom preamble from tex file for latex export reza 2023-02-17 10:08 ` Fraga, Eric @ 2023-02-17 10:30 ` Fraga, Eric [not found] ` <ea7618de-c02e-ee1a-8f32-083046ac09bb@housseini.me> 1 sibling, 1 reply; 13+ messages in thread From: Fraga, Eric @ 2023-02-17 10:30 UTC (permalink / raw) To: reza; +Cc: emacs-orgmode@gnu.org Let me try again (I first response wrong). The following may work: #+latex_header: \input{preamble} -- : Eric S Fraga, with org release_9.6.1-250-ge6353d in Emacs 30.0.50 ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <ea7618de-c02e-ee1a-8f32-083046ac09bb@housseini.me>]
* Re: Use custom preamble from tex file for latex export [not found] ` <ea7618de-c02e-ee1a-8f32-083046ac09bb@housseini.me> @ 2023-02-17 12:38 ` reza 2023-02-17 12:49 ` Fraga, Eric 0 siblings, 1 reply; 13+ messages in thread From: reza @ 2023-02-17 12:38 UTC (permalink / raw) To: emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 141 bytes --] > #+latex_header: \input{preamble} Thanks for the idea, will test this, but I fear this will collide with the latex class provided by org? [-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --] [-- Type: application/pgp-keys, Size: 15557 bytes --] [-- Attachment #3: OpenPGP_signature --] [-- Type: application/pgp-signature, Size: 499 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use custom preamble from tex file for latex export 2023-02-17 12:38 ` reza @ 2023-02-17 12:49 ` Fraga, Eric [not found] ` <b6dad7bb-9ba2-39e9-5ad5-bbfd5c7a9d74@housseini.me> 0 siblings, 1 reply; 13+ messages in thread From: Fraga, Eric @ 2023-02-17 12:49 UTC (permalink / raw) To: reza; +Cc: emacs-orgmode@gnu.org On Friday, 17 Feb 2023 at 12:38, reza wrote: > Thanks for the idea, will test this, but I fear this will collide with > the latex class provided by org? Well, you could have just the documentclass line removed from the preamble and define an org latex class appropriately. There's always going to be some need to have part of the configuration within the org file itself but it could be minimised. The full org alternative is to customise org-latex-classes with all the LaTeX preamble you want or need. This is what I do. -- : Eric S Fraga, with org release_9.6.1-250-ge6353d in Emacs 30.0.50 ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <b6dad7bb-9ba2-39e9-5ad5-bbfd5c7a9d74@housseini.me>]
* Re: Use custom preamble from tex file for latex export [not found] ` <b6dad7bb-9ba2-39e9-5ad5-bbfd5c7a9d74@housseini.me> @ 2023-02-17 13:08 ` reza 2023-02-17 13:14 ` Ihor Radchenko 2023-02-17 13:15 ` Fraga, Eric 0 siblings, 2 replies; 13+ messages in thread From: reza @ 2023-02-17 13:08 UTC (permalink / raw) To: emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 246 bytes --] > The full org alternative is to customise org-latex-classes with all the > LaTeX preamble you want or need. This is what I do. Is there a way to extend org-latex-classes inside my org file, so I can keep using C-c C-e l l (export to latex)? [-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --] [-- Type: application/pgp-keys, Size: 15557 bytes --] [-- Attachment #3: OpenPGP_signature --] [-- Type: application/pgp-signature, Size: 499 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use custom preamble from tex file for latex export 2023-02-17 13:08 ` reza @ 2023-02-17 13:14 ` Ihor Radchenko [not found] ` <4f7041fc-4d26-0308-041b-e34365613074@housseini.me> 2023-02-17 13:15 ` Fraga, Eric 1 sibling, 1 reply; 13+ messages in thread From: Ihor Radchenko @ 2023-02-17 13:14 UTC (permalink / raw) To: reza; +Cc: emacs-orgmode@gnu.org reza <reza@housseini.me> writes: >> The full org alternative is to customise org-latex-classes with all the >> LaTeX preamble you want or need. This is what I do. > > Is there a way to extend org-latex-classes inside my org file, so I can > keep using C-c C-e l l (export to latex)? Two possibilities: 1. Put file-local variable 2. Create an "Empty" class with empty documentclass statement and then #+LATEX_CLASS: Empty #+LATEX_HEADER: \input{...} -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <4f7041fc-4d26-0308-041b-e34365613074@housseini.me>]
* Re: Use custom preamble from tex file for latex export [not found] ` <4f7041fc-4d26-0308-041b-e34365613074@housseini.me> @ 2023-02-17 13:16 ` reza 2023-02-17 13:26 ` Ihor Radchenko 0 siblings, 1 reply; 13+ messages in thread From: reza @ 2023-02-17 13:16 UTC (permalink / raw) To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 341 bytes --] > Two possibilities: > > 1. Put file-local variable > 2. Create an "Empty" class with empty documentclass statement > and then #+LATEX_CLASS: Empty #+LATEX_HEADER: \input{...} > Sorry for my noobish questions: 1. How do I put file-local variables in my org file? 2. Is it possible to do this inside my org file? Thanks and cheers! [-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --] [-- Type: application/pgp-keys, Size: 15557 bytes --] [-- Attachment #3: OpenPGP_signature --] [-- Type: application/pgp-signature, Size: 499 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use custom preamble from tex file for latex export 2023-02-17 13:16 ` reza @ 2023-02-17 13:26 ` Ihor Radchenko 0 siblings, 0 replies; 13+ messages in thread From: Ihor Radchenko @ 2023-02-17 13:26 UTC (permalink / raw) To: reza; +Cc: emacs-orgmode@gnu.org reza <reza@housseini.me> writes: >> Two possibilities: >> >> 1. Put file-local variable >> 2. Create an "Empty" class with empty documentclass statement >> and then #+LATEX_CLASS: Empty #+LATEX_HEADER: \input{...} >> > > Sorry for my noobish questions: > > 1. How do I put file-local variables in my org file? M-x add-file-local-variable or M-x add-file-local-varable-prop-line The latter will put things at the bottom. The format - at the top of the file. You can also use #+BIND: keyword if you have `org-export-allow-bind-keywords' set to t. > 2. Is it possible to do this inside my org file? For self-contained file, you must set file-local variable anyway. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use custom preamble from tex file for latex export 2023-02-17 13:08 ` reza 2023-02-17 13:14 ` Ihor Radchenko @ 2023-02-17 13:15 ` Fraga, Eric [not found] ` <2660604c-3d61-890b-1088-6b56d773f674@housseini.me> 1 sibling, 1 reply; 13+ messages in thread From: Fraga, Eric @ 2023-02-17 13:15 UTC (permalink / raw) To: reza; +Cc: emacs-orgmode@gnu.org On Friday, 17 Feb 2023 at 13:08, reza wrote: > Is there a way to extend org-latex-classes inside my org file, so I can > keep using C-c C-e l l (export to latex)? Yes, should be possible. Check out info manual: (emacs) File Variables -- : Eric S Fraga, with org release_9.6.1-250-ge6353d in Emacs 30.0.50 ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <2660604c-3d61-890b-1088-6b56d773f674@housseini.me>]
* Re: Use custom preamble from tex file for latex export [not found] ` <2660604c-3d61-890b-1088-6b56d773f674@housseini.me> @ 2023-02-21 8:40 ` reza 2023-02-21 10:08 ` Fraga, Eric 0 siblings, 1 reply; 13+ messages in thread From: reza @ 2023-02-21 8:40 UTC (permalink / raw) To: emacs-orgmode@gnu.org [-- Attachment #1: Type: text/plain, Size: 1183 bytes --] > Yes, should be possible. Check out info manual: (emacs) File Variables I did manage to patch together a working example, but when I tried to move into an setupfile it doesn't work anymore. Is this intended or did I do something wrong? template.org # -*- org-export-allow-bind-keywords: t; -*- #+BIND: org-latex-classes (my-latex-classes) #+BIND: org-latex-hyperref-template nil #+LATEX_CLASS: from-file #+BEGIN_SRC emacs-lisp :exports results :results none (defun my-latex-classes '(("from-file" "\\RequirePackage{preamble}\n[NO-DEFAULT-PACKAGES]" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))) #+END_SRC report.org # -*- org-export-allow-bind-keywords: t; -*- #+title: A dummy report #+subtitle: This is a dummy report #+setupfile: ../template.org * Title asdasd This gives me an error, unknown latex class "from-file" and checking the variable "org-latex-classes" with C-h v looks like it was not set. Thanks for any help. Cheers, Reza [-- Attachment #2: OpenPGP_0xC375C6AF05125C52.asc --] [-- Type: application/pgp-keys, Size: 15557 bytes --] [-- Attachment #3: OpenPGP_signature --] [-- Type: application/pgp-signature, Size: 499 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Use custom preamble from tex file for latex export 2023-02-21 8:40 ` reza @ 2023-02-21 10:08 ` Fraga, Eric 0 siblings, 0 replies; 13+ messages in thread From: Fraga, Eric @ 2023-02-21 10:08 UTC (permalink / raw) To: reza; +Cc: emacs-orgmode@gnu.org I'm travelling so will keep this short. A few things potentially wrong with your setup: 1. the elisp src block won't be executed automatically. 2. I do not know if the BIND statements are interpreted when included but I imagine they are. Sometimes it's better to use the base Emacs features (e.g. file local variables) than try to shoehorn everything into org. -- : Eric S Fraga, with org release_9.6.1-224-g8ae8a8 in Emacs 30.0.50 ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-02-21 10:14 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1535a463-91fd-d085-06ee-ebd816c57ec8@housseini.me> 2023-02-17 8:55 ` Use custom preamble from tex file for latex export reza 2023-02-17 10:08 ` Fraga, Eric 2023-02-17 10:28 ` Fraga, Eric 2023-02-17 10:30 ` Fraga, Eric [not found] ` <ea7618de-c02e-ee1a-8f32-083046ac09bb@housseini.me> 2023-02-17 12:38 ` reza 2023-02-17 12:49 ` Fraga, Eric [not found] ` <b6dad7bb-9ba2-39e9-5ad5-bbfd5c7a9d74@housseini.me> 2023-02-17 13:08 ` reza 2023-02-17 13:14 ` Ihor Radchenko [not found] ` <4f7041fc-4d26-0308-041b-e34365613074@housseini.me> 2023-02-17 13:16 ` reza 2023-02-17 13:26 ` Ihor Radchenko 2023-02-17 13:15 ` Fraga, Eric [not found] ` <2660604c-3d61-890b-1088-6b56d773f674@housseini.me> 2023-02-21 8:40 ` reza 2023-02-21 10:08 ` Fraga, Eric
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).