emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com>
Cc: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: Org-mode extensions used to publish a dissertation
Date: Wed, 06 Aug 2014 07:38:44 -0400	[thread overview]
Message-ID: <87r40tj15a.fsf@gmail.com> (raw)
In-Reply-To: CAD-VTcF_Q61t2ZgyVFNCjWFUUjhw+sEqJijfOuh+oW6cVnuybA@mail.gmail.com

[-- 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)

  reply	other threads:[~2014-08-06 11:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2014-08-06  9:43 ` Rasmus
2014-08-06 11:41   ` Eric Schulte
2014-08-06 10:05 ` Suvayu Ali

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=87r40tj15a.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=joseph.vidal.rosset@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).