* Org-mode extensions used to publish a dissertation
@ 2014-08-05 0:23 Eric Schulte
2014-08-06 9:00 ` Joseph Vidal-Rosset
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Eric Schulte @ 2014-08-05 0:23 UTC (permalink / raw)
To: Org Mode Mailing List
[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]
Hi List,
I thoroughly enjoyed using Org-mode to write my dissertation. I was
happy to be able to export (mostly) equivalent versions of the document
to HTML and PDF. I'd recommend using Org-mode for such a complex
writing task to those who are either willing to hack the exporter, or
are willing to accept an Org-mode document with inline LaTeX which only
/really/ works with the LaTeX backend.
As I fall in the former category, here are the small extensions to the
Org-mode exporter which I found necessary. Thanks to the new exporting
backend they were uniformly easy to implement. They are included in the
attached elisp file. Each pagefeed (^L) in the file marks a new section
of functionality, the sections are as follows...
1. Ignore Headlines and keep content (discussed here recently)
2. Multi-column Table Cells
3. Wide tables extend into the margins.
4. Wide tables squeezed within the margins
5. "sc" links for the \sc{} latex command
6. "gls" links for the \gls{} family of Glossary commands
7. color links
8. TIKZ figure links
9. Tie certain latex commands to the preceding word.
10. Fix emphasis in text export
A simplified version of my Makefile is also attached. I hope someone
finds this useful.
Best,
Eric
[-- Attachment #2: init.el --]
[-- Type: application/emacs-lisp, Size: 23705 bytes --]
[-- Attachment #3: Makefile --]
[-- Type: application/octet-stream, Size: 1217 bytes --]
EMACS=emacs
BATCH_EMACS=$(EMACS) --batch -Q -l init.el
PAPER:=replace-with-paper-file-name
all: $(PAPER).pdf $(FIG_SVG)
.PHONY: all publish clean
# Export
%.html: %.org init.el
$(BATCH_EMACS) $*.org -f org-html-export-to-html
%.tex: %.org init.el org-paper-class.tex
$(BATCH_EMACS) $*.org -f org-latex-export-to-latex
%.txt: %.org init.el
$(BATCH_EMACS) $*.org -f org-export-as-utf8
%.pdf: %.tex $(FIG_TEX)
rm -f dissertation.aux
pdflatex \\nonstopmode\\input $*.tex
# Uncomment if using Bibtex
# if [ -f $*.bib ];then bibtex --min-crossref=100 $*;fi
while grep "Rerun to get" $*.log; do \
pdflatex \\nonstopmode\\input $*.tex; \
done
# Uncomment if using a Glossary
# if [ -f glossary.tex ];then makeglossaries $*;fi
pdflatex \\nonstopmode\\input $*.tex;
%.ps: %.pdf
pdf2ps $*.pdf
%.svg: %.tex
./bin/tex2svg $<
# Publish
publish/index.html: $(PAPER).html
cp $< $@
publish/%: %
cp $< $@
publish: publish/index.html publish/$(PAPER).pdf
chmod a+r $<
clean:
rm -f *~ *.aux *.log *.dvi *.blg *.bbl *.toc *.out *.html *.vrb *.snm *.nav *.ps *.lof *.lol *.lot *.glg *.glo *.gls *.glsdefs *.xdy
rm -f $(PAPER).tex $(PAPER).pdf $(PAPER).html $(PAPER).txt publish/index.html publish/$(PAPER).pdf
[-- Attachment #4: Type: text/plain, Size: 90 bytes --]
--
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Org-mode extensions used to publish a dissertation
2014-08-05 0:23 Org-mode extensions used to publish a dissertation Eric Schulte
@ 2014-08-06 9:00 ` Joseph Vidal-Rosset
2014-08-06 11:38 ` Eric Schulte
2014-08-06 9:43 ` Rasmus
2014-08-06 10:05 ` Suvayu Ali
2 siblings, 1 reply; 6+ messages in thread
From: Joseph Vidal-Rosset @ 2014-08-06 9:00 UTC (permalink / raw)
To: Eric Schulte; +Cc: Org Mode Mailing List
[-- Attachment #1: Type: text/plain, Size: 1616 bytes --]
Many thanks Eric for this email and the attachment.
Of course it is very useful.
2014-08-05 2:23 GMT+02:00 Eric Schulte <schulte.eric@gmail.com>:
> Hi List,
>
> I thoroughly enjoyed using Org-mode to write my dissertation. I was
> happy to be able to export (mostly) equivalent versions of the document
> to HTML and PDF. I'd recommend using Org-mode for such a complex
> writing task to those who are either willing to hack the exporter, or
> are willing to accept an Org-mode document with inline LaTeX which only
> /really/ works with the LaTeX backend.
>
> As I fall in the former category, here are the small extensions to the
> Org-mode exporter which I found necessary. Thanks to the new exporting
> backend they were uniformly easy to implement. They are included in the
> attached elisp file. Each pagefeed (^L) in the file marks a new section
> of functionality, the sections are as follows...
>
> 1. Ignore Headlines and keep content (discussed here recently)
> 2. Multi-column Table Cells
> 3. Wide tables extend into the margins.
> 4. Wide tables squeezed within the margins
> 5. "sc" links for the \sc{} latex command
> 6. "gls" links for the \gls{} family of Glossary commands
> 7. color links
> 8. TIKZ figure links
> 9. Tie certain latex commands to the preceding word.
> 10. Fix emphasis in text export
>
> A simplified version of my Makefile is also attached. I hope someone
> finds this useful.
>
> Best,
> Eric
>
Can you tell us how using the Makefile in order to test all these functions
for a dissertation? I am especially interested by points 2 and 8.
Best wishes ,
Jo.
[-- Attachment #2: Type: text/html, Size: 2257 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Org-mode extensions used to publish a dissertation
2014-08-05 0:23 Org-mode extensions used to publish a dissertation Eric Schulte
2014-08-06 9:00 ` Joseph Vidal-Rosset
@ 2014-08-06 9:43 ` Rasmus
2014-08-06 11:41 ` Eric Schulte
2014-08-06 10:05 ` Suvayu Ali
2 siblings, 1 reply; 6+ messages in thread
From: Rasmus @ 2014-08-06 9:43 UTC (permalink / raw)
To: emacs-orgmode
Hi Eric,
Thank you for sharing this. I have hacks for many of the same things,
but I'm sure I will find inspiration in your implementations as well
when I read them more carefully.
In particular the filters that operate directly on the tree seems
interesting! I have never really gotten into tree-manipulation.
Eric Schulte <schulte.eric@gmail.com> writes:
> 1. Ignore Headlines and keep content (discussed here recently)
> 2. Multi-column Table Cells
> 3. Wide tables extend into the margins.
For this I use a makebox and simply wrap any table with a specified
width.
> 4. Wide tables squeezed within the margins
Cool.
> 5. "sc" links for the \sc{} latex command
For this I automatically export ALLCAPS or MiXeD words with small caps
(replacing "X" with \textsc{x}). I used to use links as well, but
people I worked with found it unintuitive and didn't do it.
> 6. "gls" links for the \gls{} family of Glossary commands
> 7. color links
> 8. TIKZ figure links
Am I right to understand that the main use of this is automatically
translating tikz figures into a format suitable for HTML? The
function is a bit long and I couldn't entirely grasp the functionality
without reading the function in details.
> 9. Tie certain latex commands to the preceding word.
Cool idea with the refs!
I use something similar where I escape single space after points so
that "e.g. x" becomes "e.g.\ x".
> 10. Fix emphasis in text export
Good idea.
Cheers,
Rasmus
--
I feel emotional landscapes they puzzle me
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Org-mode extensions used to publish a dissertation
2014-08-05 0:23 Org-mode extensions used to publish a dissertation Eric Schulte
2014-08-06 9:00 ` Joseph Vidal-Rosset
2014-08-06 9:43 ` Rasmus
@ 2014-08-06 10:05 ` Suvayu Ali
2 siblings, 0 replies; 6+ messages in thread
From: Suvayu Ali @ 2014-08-06 10:05 UTC (permalink / raw)
To: emacs-orgmode
Hi Eric,
On Mon, Aug 04, 2014 at 08:23:58PM -0400, Eric Schulte wrote:
>
> 1. Ignore Headlines and keep content (discussed here recently)
> 2. Multi-column Table Cells
> 3. Wide tables extend into the margins.
> 4. Wide tables squeezed within the margins
> 5. "sc" links for the \sc{} latex command
> 6. "gls" links for the \gls{} family of Glossary commands
> 7. color links
> 8. TIKZ figure links
> 9. Tie certain latex commands to the preceding word.
> 10. Fix emphasis in text export
Thanks a lot for sharing these :).
Cheers,
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Org-mode extensions used to publish a dissertation
2014-08-06 9:00 ` Joseph Vidal-Rosset
@ 2014-08-06 11:38 ` Eric Schulte
0 siblings, 0 replies; 6+ messages in thread
From: Eric Schulte @ 2014-08-06 11:38 UTC (permalink / raw)
To: Joseph Vidal-Rosset; +Cc: Org Mode Mailing List
[-- Attachment #1: Type: text/plain, Size: 2933 bytes --]
Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:
> Many thanks Eric for this email and the attachment.
>
> Of course it is very useful.
>
> 2014-08-05 2:23 GMT+02:00 Eric Schulte <schulte.eric@gmail.com>:
>
>> Hi List,
>>
>> I thoroughly enjoyed using Org-mode to write my dissertation. I was
>> happy to be able to export (mostly) equivalent versions of the document
>> to HTML and PDF. I'd recommend using Org-mode for such a complex
>> writing task to those who are either willing to hack the exporter, or
>> are willing to accept an Org-mode document with inline LaTeX which only
>> /really/ works with the LaTeX backend.
>>
>> As I fall in the former category, here are the small extensions to the
>> Org-mode exporter which I found necessary. Thanks to the new exporting
>> backend they were uniformly easy to implement. They are included in the
>> attached elisp file. Each pagefeed (^L) in the file marks a new section
>> of functionality, the sections are as follows...
>>
>> 1. Ignore Headlines and keep content (discussed here recently)
>> 2. Multi-column Table Cells
>> 3. Wide tables extend into the margins.
>> 4. Wide tables squeezed within the margins
>> 5. "sc" links for the \sc{} latex command
>> 6. "gls" links for the \gls{} family of Glossary commands
>> 7. color links
>> 8. TIKZ figure links
>> 9. Tie certain latex commands to the preceding word.
>> 10. Fix emphasis in text export
>>
>> A simplified version of my Makefile is also attached. I hope someone
>> finds this useful.
>>
>> Best,
>> Eric
>>
>
> Can you tell us how using the Makefile in order to test all these functions
> for a dissertation?
The Makefile and the code do not need to be used together.
> I am especially interested by points 2 and 8.
>
For point 2 try adding the following above a wide table in an Org-mode
document (after evaluating the code).
#+ATTR_LaTeX: :environment wide
On export this should allow your table to cut into the page margins
(note: for my school I later had to undo this as there were strict rules
about margins in dissertations).
Point 8 is a little more involved. I prefer to convert my TIKZ figures
to svg for HTML export, and keep them as raw tikz for LaTeX export. I
found that the easiest way to do this (for me at least), was to keep the
figures in external .tex files. I would then manually generate an svg
version of these files using the tex2svg script (attached). With these
files on hand, the code in Point 8 will export Org-mode text like the
following.
#+name: llvm-mutation
#+Caption[LLVM Transformations]: Illustration of transformations over LLVM IR. These transformations require that the SSA data dependency graph be repaired after each mutation.
#+TIKZ_Figure: llvm-mutation
so that the file llvm-mutation.tex is included in LaTeX export wrapped
in a figure, and the file llvm-mutation.svg is included as an image in
HTML export.
Best,
Eric
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tex2svg --]
[-- Type: text/x-sh, Size: 1779 bytes --]
#!/bin/bash
#
# Usage: tex2svg [source.tex]
#
# Generate an SVG file from a snippet of LaTeX source code.
# The tex source should not be wrapped in begin/end{document}.
#
# Example Usage:
#
# $ cat tree.tex
# \usetikzlibrary{trees}
# \begin{tikzpicture}
# \node [circle, draw, fill=red!20] at (0,0) {1}
# child { node [circle, draw, fill=blue!30] {2}
# child { node [circle, draw, fill=green!30] {3} }
# child { node [circle, draw, fill=yellow!30] {4} }};
# \end{tikzpicture}
#
# $ ./tex2svg tree.tex
#
# $ file tree.svg
# tree.svg: SVG Scalable Vector Graphics image
#
PACKAGES=('[usenames]{color}' '{tikz}' '{color}' '{listings}' '{amsmath}' '{fancyvrb}' '{soul}')
PREAMBLE=$(cat <<EOF
\documentclass[preview]{standalone}
\def\pgfsysdriver{pgfsys-tex4ht.def}
$(for pack in ${PACKAGES[@]};do echo "\\usepackage$pack"; done)
\usepackage{algorithmic}
\usepackage{amsmath}
\usepackage{adjustbox}
\usepackage{fancyvrb}
\usepackage{booktabs}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{changepage}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.png,.jpg,.JPG}
\begin{document}
EOF
)
POSTAMBLE=$(cat <<EOF
\end{document}
EOF
)
FIG="$1"; shift;
BASE=$(basename $FIG .tex)
TMPFILE="$(mktemp).tex"
TMPBASE=`basename $TMPFILE .tex`
TMPDIR=`dirname $TMPFILE`
cp $@ $TMPDIR
function exit_hook (){ rm -f $TMPBASE* $TMPFILE*; exit 0; }
trap exit_hook EXIT
cat <<EOF > $TMPFILE
$PREAMBLE
$(cat $FIG|sed 's/\\subcaption{.*}//')
$POSTAMBLE
EOF
htlatex $TMPFILE && rm $TMPFILE
if [ -f $TMPBASE-1.svg ];then
# scour -i $TMPBASE-1.svg -o $BASE.svg \
# || cp $TMPBASE-1.svg $BASE.svg
cp $TMPBASE-1.svg $BASE.svg
echo $BASE.svg
else
cp $TMPBASE.html $BASE.html
echo $BASE.html
fi
[-- Attachment #3: Type: text/plain, Size: 115 bytes --]
> Best wishes ,
>
> Jo.
--
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Org-mode extensions used to publish a dissertation
2014-08-06 9:43 ` Rasmus
@ 2014-08-06 11:41 ` Eric Schulte
0 siblings, 0 replies; 6+ messages in thread
From: Eric Schulte @ 2014-08-06 11:41 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> Hi Eric,
>
> Thank you for sharing this. I have hacks for many of the same things,
> but I'm sure I will find inspiration in your implementations as well
> when I read them more carefully.
>
> In particular the filters that operate directly on the tree seems
> interesting! I have never really gotten into tree-manipulation.
>
With help on list I wrote one, and every subsequent filter has been a
simple extension from the first. Hopefully those included herein will
be good models for future filters.
[...]
>> 8. TIKZ figure links
>
> Am I right to understand that the main use of this is automatically
> translating tikz figures into a format suitable for HTML? The
> function is a bit long and I couldn't entirely grasp the functionality
> without reading the function in details.
>
See my reply to Joseph in this thread, hopefully it will clear this up.
This point is probably the most heavily influenced by personal
preference of all these points.
>
>> 9. Tie certain latex commands to the preceding word.
>
> Cool idea with the refs!
>
> I use something similar where I escape single space after points so
> that "e.g. x" becomes "e.g.\ x".
>
>> 10. Fix emphasis in text export
>
> Good idea.
>
> Cheers,
> Rasmus
Best,
Eric
--
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-08-06 11:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-05 0:23 Org-mode extensions used to publish a dissertation Eric Schulte
2014-08-06 9:00 ` Joseph Vidal-Rosset
2014-08-06 11:38 ` Eric Schulte
2014-08-06 9:43 ` Rasmus
2014-08-06 11:41 ` Eric Schulte
2014-08-06 10:05 ` Suvayu Ali
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.