emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kaobook tex template integration to a org file to make self-containe


From: Thomas S. Dye
Subject: Re: kaobook tex template integration to a org file to make self-contained, portable?
Date: Wed, 09 Aug 2023 07:21:04 -1000
User-agent: mu4e 1.6.10; emacs 27.1

Aloha Zenny,

Zenny <garbytrash@gmail.com> writes:

Aloha Tom,

Thank you for taking time to respond with an useful pointer. I feel like I reached the right person who is an expert in both LaTeX and Orgmode who has contributed to org-tufte book
earlier as seen in your github repo. I am a novice, fyi.

I appreciate if you take some time to point out the non-standard features in order to make Orgmode can recognize.

On Tue, Aug 8, 2023 at 10:06 PM Thomas S. Dye <tsd@tsdye.online> wrote:

 Aloha Zenny,

 Zenny <garbytrash@gmail.com> writes:
 >
> However, the pdf did not inherit all the kaobook template > features like: > > 1 Mini table of contents in the margin at the start of each > chapter.
 > 2 Chapter headings.
 > 3 Huge chapter number with a vertical line

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

--
Thomas S. Dye
https://tsdye.online/tsdye



reply via email to

[Prev in Thread] Current Thread [Next in Thread]