From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Documentclass for latex preview images Date: Sun, 07 Aug 2016 16:38:14 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWUpy-000821-Ln for emacs-orgmode@gnu.org; Sun, 07 Aug 2016 16:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWUpu-0002th-FH for emacs-orgmode@gnu.org; Sun, 07 Aug 2016 16:38:21 -0400 Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]:35501) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWUpu-0002tc-Ak for emacs-orgmode@gnu.org; Sun, 07 Aug 2016 16:38:18 -0400 Received: by mail-qk0-x22b.google.com with SMTP id x185so113424224qkc.2 for ; Sun, 07 Aug 2016 13:38:17 -0700 (PDT) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Maik =?utf-8?Q?Sch=C3=BCnemann?= Cc: emacs-orgmode@gnu.org See the variable org-format-latex-header. Maik Schünemann writes: > Hi, > > Is there an option to set the documentclass that is used in temporary files > to create latex preview images? > > I am writing math texts with org mode and am using amsthm for theorems etc > and let them be counted by chapter: > > #+LATEX_HEADER: \usepackage{amsthm} > #+LATEX_HEADER: \newtheorem{thm}{Theorem}[chapter] > #+LATEX_HEADER: \newtheorem{defn}{Definition}[chapter] > #+LATEX_HEADER: \newtheorem{prop}{Proposition}[chapter] > > After I put these lines in my .org file, latex preview images stopped > working although latex export still did. The problem is that in the > temporary files used to generate the preview images, the documentclass > article is used which doesn't define the counter chapter. > > I managed to resolve this issue for me by checking for presence of the > counter. > #+LATEX_HEADER: \makeatletter > #+LATEX_HEADER: \newcommand\ifcounter[3]{\@ifundefined{c@#1}{#3}{#2}} > #+LATEX_HEADER: \makeatother > #+LATEX_HEADER: \ifcounter{chapter}{ > #+LATEX_HEADER: \newtheorem{thm}{Theorem}[chapter] > #+LATEX_HEADER: \newtheorem{defn}{Definition}[chapter] > #+LATEX_HEADER: \newtheorem{prop}{Proposition}[chapter] > #+LATEX_HEADER: }{} > > > Is there a downside to using the same document class as the org file > specifies for export to create the preview images? > > Thanks, > Maik -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu