emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Thomas S. Dye" <tsd@tsdye.online>
To: Zenny <garbytrash@gmail.com>
Cc: "Thomas S. Dye" <tsd@tsdye.online>, emacs-orgmode@gnu.org
Subject: Re: kaobook tex template integration to a org file to make self-contained, portable?
Date: Wed, 09 Aug 2023 07:21:04 -1000	[thread overview]
Message-ID: <87r0ocumbp.fsf@tsdye.online> (raw)
In-Reply-To: <CACuV5sAdO7VdDhQnhho1BX+QOYSkHnGYf850wz80nTTDodkcMA@mail.gmail.com>

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	other threads:[~2023-08-09 18:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07  7:13 kaobook tex template integration to a org file to make self-contained, portable? Zenny
2023-08-07 11:55 ` Christian Moe
2023-08-08  8:12   ` Zenny
2023-08-08 18:35   ` Zenny
2023-08-08 18:39     ` Zenny
2023-08-08 20:02     ` Thomas S. Dye
2023-08-09  5:33       ` Zenny
2023-08-09 17:21         ` Thomas S. Dye [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0ocumbp.fsf@tsdye.online \
    --to=tsd@tsdye.online \
    --cc=emacs-orgmode@gnu.org \
    --cc=garbytrash@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).