emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* BUG: preview latex with split environment
@ 2014-10-28 15:02 Andreas Leha
  2014-10-28 15:23 ` Rasmus
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Leha @ 2014-10-28 15:02 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I encounter a BUG with org-toggle-latex-fragment on an equation that
uses amsmath's split environment.

(Exporting of the document works fine.)


The problem is that the \begin{equation},\end{equation} get stripped of
the temporary tex file.


Here is some test doc

--8<---------------cut here---------------start------------->8---
#+TITLE: Test amsmath's split

* Some equation
with some split expression, e.g.
\begin{equation}
  \begin{split}
    w \cdot x + b &= 1, \text{ and}\\
    w \cdot x + b &= -1
  \end{split}
\end{equation}

To reproduce try to org-toggle-latex-fragment (C-c C-x C-l) on that
latex expression.

Export of this works fine.
--8<---------------cut here---------------end--------------->8---

which results in this /tmp/foobar.tex document (relevant parts shown):

--8<---------------cut here---------------start------------->8---
\begin{document}
\definecolor{fg}{rgb}{0.996109,0.996109,0.996109}
\definecolor{bg}{rgb}{0.197269,0.197269,0.197269}

\pagecolor{bg}

{\color{fg}
\begin{split}
    w \cdot x + b &= 1, \text{ and}\\
    w \cdot x + b &= -1
  \end{split}
}

\end{document}
--8<---------------cut here---------------end--------------->8---

The compilation of that results in
,----
| ERROR: Package amsmath Error: \begin{split} won't work here.
| ...
| \Did you forget a preceding \begin{equation}?
`----

Regards,
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BUG: preview latex with split environment
  2014-10-28 15:02 BUG: preview latex with split environment Andreas Leha
@ 2014-10-28 15:23 ` Rasmus
  2014-10-28 17:42   ` Andreas Leha
  0 siblings, 1 reply; 7+ messages in thread
From: Rasmus @ 2014-10-28 15:23 UTC (permalink / raw)
  To: emacs-orgmode

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> Hi all,
>
> I encounter a BUG with org-toggle-latex-fragment on an equation that
> uses amsmath's split environment.
>
> The problem is that the \begin{equation},\end{equation} get stripped of
> the temporary tex file.

I can't reproduce using your document from emacs -q.
(org-version) => "8.3beta" updated today. 


-- 
However beautiful the theory, you should occasionally look at the evidence

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BUG: preview latex with split environment
  2014-10-28 15:23 ` Rasmus
@ 2014-10-28 17:42   ` Andreas Leha
  2014-10-28 22:58     ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Leha @ 2014-10-28 17:42 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> Hi all,
>>
>> I encounter a BUG with org-toggle-latex-fragment on an equation that
>> uses amsmath's split environment.
>>
>> The problem is that the \begin{equation},\end{equation} get stripped of
>> the temporary tex file.
>
> I can't reproduce using your document from emacs -q.
> (org-version) => "8.3beta" updated today. 

It seems I can.  I just pulled the master branch
(Org-mode version 8.3beta (release_8.3beta-517-g86d1a7))

I start emacs -Q -l emacs.minimal
where emacs.minimal is

--8<---------------cut here---------------start------------->8---
(add-to-list 'load-path (expand-file-name "~/local/emacs/org-mode-install/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\  |org_archive\\|txt\\)$" . org-mode))
(setq org-agenda-files '("/tmp/test.org"))
;;(require 'org-install)
;;(require 'org-habit)

(add-to-list 'load-path (expand-file-name "~/local/emacs/org-mode/contrib/lisp"))

(global-set-key "\C-ca" 'org-agenda)

(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)
   (latex . t)
   (emacs-lisp . t)
   (sh . t)))
--8<---------------cut here---------------end--------------->8---


I open this file:

--8<---------------cut here---------------start------------->8---
#+TITLE: Test amsmath's split

* Some equation
with some split expression, e.g.
\begin{equation}
  \begin{split}
    w \cdot x + b &= 1, \text{ and}\\
    w \cdot x + b &= -1
  \end{split}
\end{equation}

To reproduce try to org-toggle-latex-fragment (C-c C-x C-l) on that
latex expression.

Export of this works fine.
--8<---------------cut here---------------end--------------->8---


I try to preview my equation and get this tex:


--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage[usenames]{color}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
% Package fixltx2e omitted
\usepackage{graphicx}
% Package longtable omitted
% Package float omitted
% Package wrapfig omitted
% Package rotating omitted
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{amssymb}
% Package capt-of omitted
% Package hyperref omitted
\tolerance=1000
\pagestyle{empty}             % do not remove
% The settings below are copied from fullpage.sty
\setlength{\textwidth}{\paperwidth}
\addtolength{\textwidth}{-3cm}
\setlength{\oddsidemargin}{1.5cm}
\addtolength{\oddsidemargin}{-2.54cm}
\setlength{\evensidemargin}{\oddsidemargin}
\setlength{\textheight}{\paperheight}
\addtolength{\textheight}{-\headheight}
\addtolength{\textheight}{-\headsep}
\addtolength{\textheight}{-\footskip}
\addtolength{\textheight}{-3cm}
\setlength{\topmargin}{1.5cm}
\addtolength{\topmargin}{-2.54cm}
\begin{document}
\begin{split}
    w \cdot x + b &= 1, \text{ and}\\
    w \cdot x + b &= -1
  \end{split}
\end{document}
--8<---------------cut here---------------end--------------->8---

What do I miss here?

Regards,
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BUG: preview latex with split environment
  2014-10-28 17:42   ` Andreas Leha
@ 2014-10-28 22:58     ` Nicolas Goaziou
  2014-10-29 10:12       ` Andreas Leha
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2014-10-28 22:58 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

Hello,

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> I open this file:
>
> #+TITLE: Test amsmath's split
>
> * Some equation
> with some split expression, e.g.
> \begin{equation}
>   \begin{split}
>     w \cdot x + b &= 1, \text{ and}\\
>     w \cdot x + b &= -1
>   \end{split}
> \end{equation}
>
> To reproduce try to org-toggle-latex-fragment (C-c C-x C-l) on that
> latex expression.

This should be fixed in master. Thank you for reporting it.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BUG: preview latex with split environment
  2014-10-28 22:58     ` Nicolas Goaziou
@ 2014-10-29 10:12       ` Andreas Leha
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Leha @ 2014-10-29 10:12 UTC (permalink / raw)
  To: emacs-orgmode

Hi Nicolas,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> I open this file:
>>
>> #+TITLE: Test amsmath's split
>>
>> * Some equation
>> with some split expression, e.g.
>> \begin{equation}
>>   \begin{split}
>>     w \cdot x + b &= 1, \text{ and}\\
>>     w \cdot x + b &= -1
>>   \end{split}
>> \end{equation}
>>
>> To reproduce try to org-toggle-latex-fragment (C-c C-x C-l) on that
>> latex expression.
>
> This should be fixed in master. Thank you for reporting it.
>

I can confirm this is fixed in my use case.

Thank you very much!  That'll save me several LaTeX compilation cycles.

Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BUG: preview latex with split environment
@ 2016-04-10 19:51 Varius Various
  2016-04-10 23:05 ` Varius Various
  0 siblings, 1 reply; 7+ messages in thread
From: Varius Various @ 2016-04-10 19:51 UTC (permalink / raw)
  To: emacs-orgmode


Andreas Leha <address@hidden> writes:
>Nicolas Goaziou <address@hidden> writes:
>> Hello,
>>
>> Andreas Leha <address@hidden> writes:
>>
>>> I open this file:
>>>
>>> #+TITLE: Test amsmath's split
>>>
>>> * Some equation
>>> with some split expression, e.g.
>>> \begin{equation}
>>>   \begin{split}
>>>     w \cdot x + b &= 1, \text{ and}\\
>>>     w \cdot x + b &= -1
>>>   \end{split}
>>> \end{equation}
>>>
>>> To reproduce try to org-toggle-latex-fragment (C-c C-x C-l) on that
>>> latex expression.
>>
>> This should be fixed in master. Thank you for reporting it.
>>
>
>I can confirm this is fixed in my use case.
>
>Thank you very much!  That'll save me several LaTeX compilation cycles.

I have no problem with Andreas' example, but it fails in my case, where
"&" symbols are at the beginning of a line:

\begin{equation}
 \begin{split}
 (a - b) + c &= (a + (-b)) + c\\
  &= a + (-b + c)\\
  &= a + (c - b)\\
  &= (a + c) - b\text{.}
 \end{split}
\end{equation}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BUG: preview latex with split environment
  2016-04-10 19:51 Varius Various
@ 2016-04-10 23:05 ` Varius Various
  0 siblings, 0 replies; 7+ messages in thread
From: Varius Various @ 2016-04-10 23:05 UTC (permalink / raw)
  To: emacs-orgmode


Never mind, the problem was me trying to invoke
`org-preview-latex-fragment' somewhere inside the equation, but when I'm
doing it outside - it works.

Sorry about the noise.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-04-10 23:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-28 15:02 BUG: preview latex with split environment Andreas Leha
2014-10-28 15:23 ` Rasmus
2014-10-28 17:42   ` Andreas Leha
2014-10-28 22:58     ` Nicolas Goaziou
2014-10-29 10:12       ` Andreas Leha
  -- strict thread matches above, loose matches on Subject: below --
2016-04-10 19:51 Varius Various
2016-04-10 23:05 ` Varius Various

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