From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Maik_Sch=C3=BCnemann?= Subject: Documentclass for latex preview images Date: Fri, 5 Aug 2016 15:22:22 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0102f15ce89519053952f4f5 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVf50-0007hA-1I for emacs-orgmode@gnu.org; Fri, 05 Aug 2016 09:22:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bVf4y-0007BI-1O for emacs-orgmode@gnu.org; Fri, 05 Aug 2016 09:22:24 -0400 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:35056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVf4x-0007BC-Qd for emacs-orgmode@gnu.org; Fri, 05 Aug 2016 09:22:23 -0400 Received: by mail-wm0-x22f.google.com with SMTP id f65so31390447wmi.0 for ; Fri, 05 Aug 2016 06:22:23 -0700 (PDT) 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: emacs-orgmode@gnu.org --089e0102f15ce89519053952f4f5 Content-Type: text/plain; charset=UTF-8 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 --089e0102f15ce89519053952f4f5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,=C2=A0

Is there an option to set the= documentclass that is used in temporary files to create latex preview imag= es?=C2=A0

I am writing math texts with org mode an= d am using amsthm for theorems etc and let them be counted by chapter:

#+LATEX_HEADER: \usepackage{amsthm}
#+LATEX_HEADER: \newtheorem{thm}{Theorem}[chapter]
#+LATEX_HEADE= R: \newtheorem{defn}{Definition}[chapter]
#+LATEX_HEADER: \newthe= orem{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 re= solve this issue for me by checking for presence of the counter.
=
#+LATEX_HEADER: \makeatletter
#+LATEX_HEADER: \newcommand\if= counter[3]{\@ifundefined{c@#1}{#3}{#2}}
#+LATEX_HEADER: \makeatot= her
#+LATEX_HEADER: \ifcounter{chapter}{
#+LATEX_HEADER= : \newtheorem{thm}{Theorem}[chapter]
#+LATEX_HEADER: \newtheorem{= defn}{Definition}[chapter]
#+LATEX_HEADER: \newtheorem{prop}{Prop= osition}[chapter]
#+LATEX_HEADER: }{}

<= div>
Is there a downside to using the same document class as = the org file specifies for export to create the preview images?
<= br>
Thanks,=C2=A0
Maik

--089e0102f15ce89519053952f4f5--