Joseph Vidal-Rosset <joseph.vidal.ros...@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.e...@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
#!/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
> Best wishes , > > Jo. -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D (see https://u.fsf.org/yw)