I use Emacs + org-mode to maintain my website.

Here some related parts of my configuration:

(defvar personal-website-remote-directory-prefix "/ssh:***:/srv/www/stefanorodighiero.net/")
(defun personal-website-remote-absolute-directory (directory)
  (concat personal-website-remote-directory-prefix directory))

(setq org-publish-project-alist
     :components ("website-pages" "website-images"))

     :base-directory "/home/larsen/www/stefanorodighiero.net/"
     :base-extension "org"
     :exclude "posts"
     :publishing-function org-html-publish-to-html
     :publishing-directory ,(personal-website-remote-absolute-directory "/")
     :recursive t
     :html-preamble ,personal-website-navigation-header

     :base-directory "/home/larsen/www/stefanorodighiero.net/images/"
     :base-extension "png\\|jpg\\|JPG\\|gif"
     :publishing-function org-publish-attachment
     :recursive t
     :publishing-directory ,(personal-website-remote-absolute-directory "images/")

A couple of things in particular are important in the context of this question:

  • website-pages is any org file that is found looking recursively in my website directory tree. To publish them I use org-html-publish-to-html

  • website-images have to in the images/ directory to be copied to the production site. When I need to add a image in a page, I put the file in images/, and I manually add a file:../images/... link in the org file (with the appropriate number of ../ in front of it, depending on where the org file is). This is not ideal but it worked acceptably for the amount of content I produce.

Now, I'd like to use TikZ to produce graphics to be included in my pages. After some experiments, I've settled on adding these instructions to the pages where I want to include inline TikZ snippets.

#+OPTIONS: tex:imagemagick
#+LaTeX_HEADER: \usepackage{tikz}

It works well when I ask a preview (C-c C-e h h): the image files produced by TikZ + convert are put in the directory configured in org-preview-latex-image-directory (default is ltximg, so a relative path).

When I want to publish the page, on the other hand, the images are ignored because they're not under images/, nor they are org files to be considered for publication.

I could configure org-preview-latex-image-directory to put the images in the images/ directory: I think publishing would work, but local preview would not.

How could I organize the configuration to have automatic preview and publication in my workflow?

  • And what about making the directory org-preview-latex-image-directory to be a symbolic or hard link to images ? – jgomo3 Apr 18 '18 at 22:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.