Open zenny opened 11 months ago
Hi, I managed to produce a pdf using the ggm.org
file from https://github.com/asilata/emacsconf2021by appending the following in the setup
section of the org file:
** Org LaTeX setup
#+latex_class: kaobook
#+latex_class_options: [openany, a4paper]
#+latex_header: \usepackage{amsmath,amssymb,amsthm,geometry,hyperref,paralist,svg,thmtools,tikz,tikz-cd}
#+latex_header: \usepackage{mathtools}
#+latex_header: \usepackage[capitalise,noabbrev]{cleveref}
#+latex_header: \usepackage{environ} \NewEnviron{abmn}{\marginnote{\BODY}}
#+latex_header: \setcounter{tocdepth}{1}
#+latex_header: \newtheorem{theorem}{Theorem}
#+latex_header: \newtheorem{example}[theorem]{Example}
#+latex_header: \newtheorem{exmpl}[theorem]{Example}
#+latex_header: \newtheorem{definition}[theorem]{Definition}
#+latex_header: \newtheorem{proposition}[theorem]{Proposition}
#+latex_header: \newtheorem{lemma}[theorem]{Lemma}
#+latex_header: \newtheorem{exercise}[theorem]{Exercise}
#+latex_header: \usetikzlibrary{arrows,automata,positioning}
** Export settings
Export into the artifacts directory
#+export_file_name: artifacts/ggm
Add ~kaobook~ to ~org-latex-classes~ and update ~org-latex-pdf-process~.
#+name: export-setup
#+begin_src emacs-lisp :results silent :var this-year="2023"
(add-to-list 'org-latex-classes
`("kaobook"
,(string-join
'("\\documentclass{kaobook}"
"\\usepackage{color}"
"\\usepackage{amsmath,amssymb}")
"\n")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
But the produced pdf has some principal features missing from kaobook template which merits kaobook
over tufte-book
template, namely:
I have attached the produced pdf here. Any suggestion to realize the features missing as above? Thanks!
Hi again,
With some inputs from Tom in https://list.orgmode.org/CACuV5sBZ39QB0bkYXi_8zkTuaYGRbJdvOkgzPymNGB1fGT-KbQ@mail.gmail.com/T/#u (quoted below) who stated that there are some non-standard LaTeX commands:
The kaobook.cls defines non-standard LaTeX commands for some of
its features. Org mode doesn't know about these, so you'll have
to figure out how Org mode can recognize and export them.
...
I haven't used kaobook, so I can't offer specific pointers. I
have used Tufte LaTeX with Org mode, so I can give general
pointers.
A LaTeX class, such as kaobook, typically redefines standard LaTeX
commands and environments, and also defines non-standard commands
and environments. So, you should first check if your system
correctly compiles a pdf from the LaTeX examples supplied with
kaobook. When the LaTeX side is working correctly, then you'll
want to identify non-standard commands and environments defined by
the kaobook class. In the style and class files you might search
for \newcommand and \newenvironment, or the documentation might
identify the user facing non-standard commands and environments.
These are the ones you'll need to configure specially.
I typically use Org mode macros to insert non-standard LaTeX
commands. Here are some I use with non-standard commands from
Tufte LaTex:
#+MACRO: newthought \newthought{$1}
#+MACRO: sidenote \sidenote[$2][$3]{$1}
#+MACRO: marginnote \marginnote[$2]{$1}
#+MACRO: urlnote \sidenote[$2][$3]{\url{$1}}
Non-standard environments are a bit trickier.
First, you might be able to wrap the non-standard environment like
this in your Org mode file:
#+begin_<<kaobook-environment>>
Something that should be wrapped in <<kaobook-environment>>.
#+end_<<kaobook-environment>>
For figures and tables, you can pass an arbitrary argument to
:float. I do this for the Tufte LaTeX marginfigure environment:
#+attr_latex: :float marginfigure :height 1.2in
#+attr_latex: :float marginfigure :options angle=90
#+attr_latex: :placement [ht!] \setfloatalignment{b}
The last example abuses attr_latex to pass a non-standard LaTeX
command that Tufte LaTeX uses to tweak the vertical alignment of
the figure.
Good luck!
hth,
Tom
@fmarotta would you mind enlisting the non-standard LaTeX
commands? Appreciate that.
Cheers,
Summary
@fmarotta Kudos to you for creating such a nice text template which is better than tufte-book, imo.
Meanwhile it would be more convenient if this tex template could be integrated to the emacs orgmode so that as self-contained portable kaobook org file can be generated. If someone has done so let me know with the link, and ignore this feature request.
Details
It would be better to create an emacs org-mode template to
kaobook
so that one can create a portable orgmode file with allkaobook
files. There is a a very nice orgmode template fortufte-book
in https://github.com/asilata/emacsconf2021.She has just appended the following under
setup
in the orgmode file as follows:and the following under
local variables
as follows:Quite nifty! So I am seeking inputs from a master of emacs orgmode and LaTeX so that such a beautiful
kaobook
template can be made self-contained and portable orgmode file.Additional context
The amount of convenience my feature may bring with such an self-contained portable org file has been presented by @asilata in https://emacsconf.org/2021/talks/babel/ or can be watched in https://www.youtube.com/watch?v=1Ooi4KAd2FM.
Cheers, /z