GithubHelp home page GithubHelp logo

ox-chameleon's Introduction

Org Chameleon Export

Sometimes you want your exports to blend in with your Emacs theme.

logo.svg

This currently only works with LaTeX exports, but it would be nice if more formats could be supported in future. To use with LaTeX just change the documents #+latex_class to use the pseudo-class chameleon and org-latex-default-class will be used with some extra generated preamble content to make the result similar to your buffer ๐Ÿ™‚.

Required ox-latex tweaks

For ox-chameleon to work, two things are needed:

  1. Some KOMA-script tooling, provided by either a. Using a KOMA class, such as scrartcl, scrrept, or scrbook b. Adding the scrextend package
  2. The xcolor package, if its not already part of the preamble

To add packages to the LaTeX preamble globally, you can use org-latex-packages-alist like so

(add-to-list 'org-latex-packages-alist '("" "scrextend" nil))
(add-to-list 'org-latex-packages-alist '("" "xcolor" nil))

Alternatively, you can just add them to documents where ox-chameleon is used, like so

#+latex_header: \usepackage{scrextend}
#+latex_header: \usepackage{xcolor}

ox-chameleon's People

Contributors

elken avatar tecosaur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

elken

ox-chameleon's Issues

latex export fails to render properly without additional config

Description of Issue

When trying to render a plain org file without any latex config, the export process doesn't succeed and looks like this:

image
This is the original org file:

- Hello
- This is content
- This is more content
- This is, believe it or not, more content
\(\lambda + \lambda = \lambda\)

But, after pulling in `xcolor like so:

#+latex_header: \usepackage{xcolor}

the output looks a lot cleaner, but there's still some unexpected text (theme is ef-spring)

image
The first error in Org PDF Latex Output is:

! Undefined control sequence.
l.57 \addtokomafont
                 {title}{\color{documentTitle}}

So, I might be missing a koma-related class, but running :

grep "\.cls" `kpsewhich --var-value TEXMFDIST`/ls-R > $HOME/allcls.txt

showed I had them all. So I started looking through teco's config for something koma related, and pasted the following: https://pastebin.com/NYuFY3Tr into my config, copied from: https://github.com/tecosaur/emacs-config/blob/master/config.org#class-templates

And the output worked as expected, with no extra text:
image

Org code block uses default theme

image

Given the below slide exported to ox-latex via beamer, the above is output.

#+begin_src org
,* DONE Make screenshots
   CLOSED: [2020-09-03 Thu 18:24]

,* DONE Restyle Site CSS
Go through [[file:style.scss][stylesheet]]

,* TODO Check CSS on main pages [42%]
- [X] Index page
- [X] Quickstart
- [ ] Features
- [ ] Releases
- [X] Install
- [ ] Manual
- [ ] Contribute
#+end_src

And produces the below LaTeX

\section{Time to go deeper}
\label{sec:org436685a}
\begin{frame}[label={sec:orga0e0885},fragile]{Headings}
 \begin{Code}
\begin{Verbatim}
\color{EFD}\textcolor[HTML]{0000ff}{*} \textcolor[HTML]{4C566A}{\textbf{DONE}} \textcolor[HTML]{4C566A}{Make screenshots}
   \textcolor[HTML]{78808f}{CLOSED:} \textcolor[HTML]{EBCB8B}{[2020-09-03 Thu 18:24]}

\textcolor[HTML]{0000ff}{*} \textcolor[HTML]{4C566A}{\textbf{DONE}} \textcolor[HTML]{4C566A}{Restyle Site CSS}
Go through \textcolor[HTML]{ff8e00}{\textbf{[[file:style.scss][stylesheet]]}}

\textcolor[HTML]{0000ff}{*} \textcolor[HTML]{A3BE8C}{\textbf{TODO}} \textcolor[HTML]{0000ff}{Check CSS on main pages} \textcolor[HTML]{A3BE8C}{\textbf{[42\%]}}
\textcolor[HTML]{81A1C1}{-} \textcolor[HTML]{4C566A}{[X]} \textcolor[HTML]{4C566A}{Index page}
\textcolor[HTML]{81A1C1}{-} \textcolor[HTML]{4C566A}{[X]} \textcolor[HTML]{4C566A}{Quickstart}
\textcolor[HTML]{81A1C1}{-} [ ] Features
\textcolor[HTML]{81A1C1}{-} [ ] Releases
\textcolor[HTML]{81A1C1}{-} \textcolor[HTML]{4C566A}{[X]} \textcolor[HTML]{4C566A}{Install}
\textcolor[HTML]{81A1C1}{-} [ ] Manual
\textcolor[HTML]{81A1C1}{-} [ ] Contribute
\end{Verbatim}
\end{Code}
\end{frame}

It's picked up some of my theme, but otherwise defaulted to the built-in colourings.

tcolorbox commands in the preamble

EDIT: Wrong repo, this is an issues with engraved faces.

Since ox-chameleon uses tcolorbox (as \usepackage[breakable,xparse]{tcolorbox}), I can't usepackage-it explicitly. This is fine in general, I can just assume it's loaded. The problem is when I want to use \newtcolorbox to define a custom box style. I can't use this command in the preamble since the ordering looks like the following in the tex file:

% added by me as a #+latex_header:
\newtcolorbox{some-options}

% produced by ox-chameleon:
\usepackage[breakable,xparse]{tcolorbox}

\DeclareTColorBox[]{Code}{o}%
{some-options}

Which throws an error since LaTeX sees \newtcolorbox before tcolorbox is included.

Is there some way to move the ox-chameleon headers to before the headers added by the user in the org-file?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.