1

I'm looking for a way to organize and share my LaTeX macros file. Ideally, I would like to write an org-mode file to export

  • as a documentation file in html or pdf for sharing
  • as a bare macros.tex containing only the macros

For instance, the org-file would look like

* Number sets

lorem ipsum

#+BEGIN_SRC latex
\def\R{{\mathbf R}}
\def\C{{\mathbf C}}
\def\N{{\mathbf N}}
#+END_SRC

The output in LaTeX would contain only

\def\R{{\mathbf R}}
\def\C{{\mathbf C}}
\def\N{{\mathbf N}}

The output in html would display

Number sets

Lorum ipsem

\def\R{{\mathbf R}}
\def\C{{\mathbf C}}
\def\N{{\mathbf N}}

Any idea ?

| improve this question | | | | |
  • Look up tangling in the Org mode manual. – NickD Feb 27 at 22:16
3

Found it. Thanks. The solution is

#+BEGIN_SRC latex :tangle yes :exports code
\def\R{{\mathbf R}}
\def\C{{\mathbf C}}
\def\N{{\mathbf N}}
#+END_SRC

When using the function org-babel-tangle I get my bare .tex file and normal export function of org-more yields the html file.

| improve this answer | | | | |
  • BTW, you can accept your own answer (assuming it works for you :-)). That is a good thing to do: it shows future visitors who might have the same or similar question that the answer actually answered the original question and therefore is a good bet to answer their question. – NickD Feb 28 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.