emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* LaTeX math export problems
@ 2020-08-18  9:12 Nick Higham
  2020-08-18 13:51 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Higham @ 2020-08-18  9:12 UTC (permalink / raw)
  To: emacs-orgmode

I use Org for producing LaTeX (e.g., all of https://github.com/higham/what-is
is produced from Org source).

I'm finding that Org has trouble parsing some LaTeX math expressions and
I then have to make seemingly arbitrary tweaks to get it to parse correctly.

I thought this might be to do with something in my .emacs, but the same
problem happens with a bare bones Emacs. A simple example is this file:

#################################################################
# ex1a_bad.org
\[
     \widehat{y} = f(x+\widehat{x}) + \Delta y,
     \quad |\widehat{y}| \le \epsilon |y|, \;
           |\widehat{x}| \le \epsilon |x|
\]
#################################################################

With emacs -q and

  This is GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29
  org-version is a variable defined in 'org.el'. Its value is "9.1.9"

I get as the exported LaTeX:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Created 2020-08-18 Tue 10:08
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 26.3 (Org mode 9.1.9)},
 pdflang={English}}
\begin{document}

\tableofcontents

$\backslash$[
     \widehat{y} = f(x+\widehat{x}) + \(\Delta\) y,
     \quad |\widehat{y}| \(\le\) \(\epsilon\) |y|, $\backslash$;
\begin{center}
\begin{tabular}{lll}
\widehat{x} & \(\le\) \(\epsilon\) & x\\
\end{tabular}
\end{center}
$\backslash$]
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The backslashes are being interpreted literally and the pipes are being
interpreted as a table.  Yet this version processes correctly:

#################################################################
# ex1a_good.org
\[
    \widehat{y} = f(x+\widehat{x}) + \Delta y,
    \quad |\widehat{y}| \le \epsilon |y|, \; |\widehat{x}| \le \epsilon |x|
\]
#################################################################

I have other simple examples like this one.

The same thing happens with my usual Emacs configuration, which uses Org 9.3.7.

---Nick Higham


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

* Re: LaTeX math export problems
  2020-08-18  9:12 LaTeX math export problems Nick Higham
@ 2020-08-18 13:51 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2020-08-18 13:51 UTC (permalink / raw)
  To: Nick Higham; +Cc: emacs-orgmode

Hello,

Nick Higham <highamnj@gmail.com> writes:

> I thought this might be to do with something in my .emacs, but the same
> problem happens with a bare bones Emacs. A simple example is this file:
>
> #################################################################
> # ex1a_bad.org
> \[
>      \widehat{y} = f(x+\widehat{x}) + \Delta y,
>      \quad |\widehat{y}| \le \epsilon |y|, \;
>            |\widehat{x}| \le \epsilon |x|
> \]
> #################################################################

In Org, \[...\] is inline markup, so it is weaker than tables.
Therefore, Org cannot see your LaTeX environment. You can use

  \begin{equation*}
  ...
  \end{equation*}

instead and lift the ambiguity.

Regards,
-- 
Nicolas Goaziou


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

end of thread, other threads:[~2020-08-18 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-18  9:12 LaTeX math export problems Nick Higham
2020-08-18 13:51 ` Nicolas Goaziou

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