emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: parsing latex ``$\mathit{math}$'' in export [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
@ 2017-05-12 13:41 Joe Corneli
  2017-05-12 15:37 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Corneli @ 2017-05-12 13:41 UTC (permalink / raw)
  To: emacs-orgmode


With the test file as follows:
======================================================================
#+TITLE:     example
#+AUTHOR:    Joe Corneli
#+DATE:      May 12, 2017
#+DESCRIPTION: example
#+LANGUAGE: en
#+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js

``Every $P$ is a $P$'' 
======================================================================

... I see this behaviour:

I run org-html-export-as-html, and the output file contains:

``Every P is a $P$''

... I would have expected:

``Every P is a P''
======================================================================


Emacs  : GNU Emacs 25.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.13)
 of 2016-08-15
Package: Org mode version 9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)

current state:
==============
(setq
 org-tree-slide-mode-hook '(toggle-org-cloaking)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
                      org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate
                          org-babel-speed-command-activate)
 org-agenda-diary-file "~/postdoc.git/org/work.org"
 org-occur-hook '(org-first-headline-recenter)
 org-use-fast-todo-selection 'prefix
 org-clock-in-prepare-hook '((lambda nil
                              (if (not pomodoro-is-active)
                               (let ((minutes (read-number "Start timer: " 90)))
                                (when org-timer-current-timer (org-timer-stop))
                                (org-timer-set-timer minutes) (pomodoro-mode))
                               )
                              )
                             )
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-log-done 'note
 org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-image-actual-width nil
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-latex-pdf-process '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f  %f")
 org-agenda-prefix-format '((agenda . " %i %-10:c%?-12t% s")
                            (timeline . "  % s") (todo . " %i %-12:c")
                            (tags . " %i %-12:c") (search . " %i %-12:c"))
 org-agenda-custom-commands '(("a" agenda ""
                               ((org-agenda-include-diary t)
                                (org-agenda-remove-tags t))
                               )
                              )
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-default-notes-file "~/postdoc.git/org/blotter.org"
 org-todo-keyword-faces '(("META" :foreground "darkgreen" :background "snow"
                           :box (:line-width -1))
                          ("NOTE" :foreground "lightgreen" :weight bold)
                          ("LOW" :foreground "#cb4b16" :background "snow"
                           :weight bold :box (:line-width -1))
                          ("MED" :foreground "goldenrod" :background "cornsilk"
                           :weight bold :box (:line-width -1))
                          ("HIGH" :foreground "darkgreen" :background "honeydew"
                           :weight bold :box (:line-width -1))
                          ("NICE" :foreground "blue" :background "honeydew"
                           :weight bold :box (:line-width -1))
                          ("MUST" :foreground "purple" :background "honeydew"
                           :weight bold :box (:line-width -1))
                          ("TODO" :foreground "black" :background "snow" :weight
                           bold :box (:line-width -1))
                          ("DONE" . org-done) ("WONTFIX" . org-done)
                          ("ONICE" . org-done) ("QUESTION" . org-done))
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-from-is-user-regexp "\\<Joe\\>"
 org-html-postamble t
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
                     org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '((lambda nil
                  (font-lock-add-keywords nil
                   (quote
                    (("^\\s-*?\\(-\\{1\\}\\|[0-9]+\\.\\)\\s-" 1
                      font-lock-warning-face t)
                     )
                    )
                   )
                  (font-lock-add-keywords nil
                   (quote (("^\\(-\\{5,\\}\\)" 1 font-lock-type-face t))))
                  )
                 (closure
                  (org-inlinetask-min-level buffer-face-mode-face org-mode-map
                   org-tbl-menu org-org-menu org-struct-menu org-entities
                   org-last-state org-id-track-globally org-clock-start-time
                   texmathp-why remember-data-file
                   org-agenda-tags-todo-honor-ignore-options
                   iswitchb-temp-buflist calc-embedded-open-mode
                   calc-embedded-open-formula calc-embedded-close-formula
                   align-mode-rules-list org-emphasis-alist
                   org-emphasis-regexp-components org-export-registered-backends
                   org-modules org-babel-load-languages t)
                  nil
                  (add-hook (quote change-major-mode-hook)
                   (quote org-show-block-all) (quote append) (quote local))
                  )
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-babel-show-result-all
                    append local]
                   5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-refile-targets '((org-agenda-files :maxlevel . 1)
                      ("~/postdoc.git/org/alt/backlog.org" :maxlevel . 1))
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-make-link-description-function 'rewrite-link
 org-agenda-sorting-strategy '((agenda todo-state-down tag-up category-keep
                                priority-down)
                               (todo todo-state-down tag-up priority-down
                                category-keep)
                               (tags priority-down category-keep)
                               (search category-keep))
 org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"]
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 org-timer-done-hook '((lambda nil (message "Timer done!")
                        (when pomodoro-is-active
                         (save-excursion
                          (set-buffer (get-file-buffer org-agenda-diary-file))
                          (pomodoro-mode -1))
                         (message "Pomodoro done!")
                         (notifications-notify :title "time over" :body
                          "record comments and take a break")
                         (start-process-shell-command "cvlc" nil
                          (concat "cvlc --play-and-exit --no-video "
                           timer-done-sound-file)
                          )
                         (org-clock-out))
                        )
                       )
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
                  org-cycle-show-empty-lines
                  org-optimize-window-after-visibility-change)
 org-agenda-hide-tags-regexp "write"
 org-html-postamble-format '(("en"
                              "<p class=\"author\">Author: %a</p>\n<p class=\"date\">Created: %d</p>\n<p class=\"date\">Revised: May 12, 2017</p>\n<p class=\"validation\">%v</p>")
                             )
 org-archive-location "~/postdoc.git/org/work.org::datetree/"
 org-agenda-use-time-grid nil
 org-agenda-finalize-hook '(remove-todo-and-cookies place-agenda-tags)
 org-export-before-processing-hook '((lambda (x)
                                      (setq org-html-postamble-format
                                       (list
                                        (list "en"
                                         (concat
                                          "<p class=\"author\">Author: %a</p>\n<p class=\"date\">Created: %d</p>\n<p class=\"date\">Revised: "
                                          (format-time-string "%B %-d, %Y")
                                          "</p>\n<p class=\"validation\">%v</p>")
                                         )
                                        )
                                       )
                                      )
                                     )
 org-todo-keywords '((sequence "META(M)" "NOTE(n)" "NICE(i)" "LOW(l)" "MED(m)"
                      "HIGH(h)" "MUST(u)" "TODO(t)" "|" "DONE(d)" "WONTFIX(w)"
                      "ONICE(o)" "QUESTION(q)")
                     )
 org-timer-default-timer 90
 org-export-allow-bind-keywords t
 org-babel-tangle-lang-exts '(("clojure" . "clj") ("emacs-lisp" . "el")
                              ("elisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-link-parameters '(("id" :follow org-id-open)
                       ("rmail" :follow org-rmail-open :store
                        org-rmail-store-link)
                       ("mhe" :follow org-mhe-open :store org-mhe-store-link)
                       ("irc" :follow org-irc-visit :store org-irc-store-link)
                       ("info" :follow org-info-open :export org-info-export
                        :store org-info-store-link)
                       ("gnus" :follow org-gnus-open :store org-gnus-store-link)
                       ("docview" :follow org-docview-open :export
                        org-docview-export :store org-docview-store-link)
                       ("bibtex" :follow org-bibtex-open :store
                        org-bibtex-store-link)
                       ("bbdb" :follow org-bbdb-open :export org-bbdb-export
                        :complete org-bbdb-complete-link :store
                        org-bbdb-store-link)
                       ("w3m" :store org-w3m-store-link)
                       ("cite" :follow org-bibtex-goto-citation :export nil)
                       ("mu4e" :follow org-mu4e-open :export nil) ("file+sys")
                       ("file+emacs") ("doi" :follow org--open-doi-link)
                       ("elisp" :follow org--open-elisp-link)
                       ("file" :complete org-file-complete-link)
                       ("ftp" :follow
                        (lambda (path) (browse-url (concat "ftp:" path))))
                       ("help" :follow org--open-help-link)
                       ("http" :follow
                        (lambda (path) (browse-url (concat "http:" path))))
                       ("https" :follow
                        (lambda (path) (browse-url (concat "https:" path))))
                       ("mailto" :follow
                        (lambda (path) (browse-url (concat "mailto:" path))))
                       ("news" :follow
                        (lambda (path) (browse-url (concat "news:" path))))
                       ("shell" :follow org--open-shell-link))
 org-structure-template-alist '(("s" "#+BEGIN_SRC ?\n\n#+END_SRC")
                                ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE")
                                ("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE")
                                ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE")
                                ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM")
                                ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER")
                                ("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX")
                                ("L" "#+LaTeX: ")
                                ("h" "#+BEGIN_HTML\n?\n#+END_HTML")
                                ("H" "#+HTML: ")
                                ("a" "#+BEGIN_ASCII\n?\n#+END_ASCII")
                                ("A" "#+ASCII: ") ("i" "#+INDEX: ?")
                                ("I" "#+INCLUDE: %file ?")
                                ("x" "#+BEGIN_COMMENT\n?\n#+END_COMMENT"))
 org-babel-load-languages '((clojure . t) (emacs-lisp . t))
 org-clock-sound t
 org-cycle-global-at-bob t
 org-tree-slide-slide-in-effect nil
 org-agenda-include-deadlines nil
 org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
 org-agenda-mode-hook '(hide-notes)
 org-agenda-files '("~/postdoc.git/org/")
 org-clock-out-hook '((lambda nil
                       (when (timerp org-timer-countdown-timer)
                        (save-excursion
                         (set-buffer (get-file-buffer org-agenda-diary-file))
                         (pomodoro-mode -1))
                        (cancel-timer org-timer-countdown-timer))
                       (let ((comments (read-string "Comments: ")))
                        (save-excursion (org-set-property "SUMMARY" comments)))
                       (let ((minutes (read-number "Take a break: " 5)))
                        (when (> minutes 0) (org-agenda-list)
                         (org-agenda-diary-entry-in-org-file-programmatically
                          (concat (int-to-string minutes) " minute break "
                           (substring (current-time-string) 11 16))
                          )
                         (org-agenda-list) (search-forward "break")
                         (goto-char (line-beginning-position))
                         (org-timer-set-timer minutes))
                        )
                       )
                      org-clock-remove-empty-clock-drawer)
 )

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

* Re: Bug: parsing latex ``$\mathit{math}$'' in export [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
  2017-05-12 13:41 Bug: parsing latex ``$\mathit{math}$'' in export [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)] Joe Corneli
@ 2017-05-12 15:37 ` Nicolas Goaziou
  2017-05-12 18:06   ` Joe Corneli
       [not found]   ` <108e9a8cdc924e71afc3324c4bd4d1eb@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2017-05-12 15:37 UTC (permalink / raw)
  To: Joe Corneli; +Cc: emacs-orgmode

Hello,

Joe Corneli <holtzermann17@gmail.com> writes:

> With the test file as follows:
> ======================================================================
>
> #+TITLE:     example
> #+AUTHOR:    Joe Corneli
>
> #+DATE:      May 12, 2017
> #+DESCRIPTION: example
>
> #+LANGUAGE: en
> #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
>
> #+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc
> #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
>
> ``Every $P$ is a $P$'' 
> ======================================================================
>
> ... I see this behaviour:
>
> I run org-html-export-as-html, and the output file contains:
>
> ``Every P is a $P$''
>
> ... I would have expected:
>
> ``Every P is a P''

True. This is because in Org mode (and in Text mode), "'" is considered
as a word-constituent instead of being a punctuation element.

I'm not convinced it is worth changing the syntax class of "'" or even
making a special case for "'". You can get rid of this problem using
\(P\) instead.

Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: parsing latex ``$\mathit{math}$'' in export [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
  2017-05-12 15:37 ` Nicolas Goaziou
@ 2017-05-12 18:06   ` Joe Corneli
  2017-05-13  7:24     ` Nicolas Goaziou
       [not found]   ` <108e9a8cdc924e71afc3324c4bd4d1eb@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  1 sibling, 1 reply; 5+ messages in thread
From: Joe Corneli @ 2017-05-12 18:06 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode mailing list

On Fri, May 12, 2017 at 4:37 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:


> I'm not convinced it is worth changing the syntax class of "'" or even
> making a special case for "'". You can get rid of this problem using
> \(P\) instead.

Thanks for suggesting this work around, I didn't know that bit of syntax!

-Joe

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

* Re: Bug: parsing latex ``$\mathit{math}$'' in export [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
       [not found]   ` <108e9a8cdc924e71afc3324c4bd4d1eb@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-05-12 18:57     ` Eric S Fraga
  0 siblings, 0 replies; 5+ messages in thread
From: Eric S Fraga @ 2017-05-12 18:57 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]

On Friday, 12 May 2017 at 18:06, Joe Corneli wrote:
> On Fri, May 12, 2017 at 4:37 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
>
>> I'm not convinced it is worth changing the syntax class of "'" or even
>> making a special case for "'". You can get rid of this problem using
>> \(P\) instead.
>
> Thanks for suggesting this work around, I didn't know that bit of syntax!

And if typing $...$ is hardwired, as it is for me, or because it's
easier to type than the alternative, you can use this code snippet to
change a $ when typed on the fly to \(..\):

#+begin_src emacs-lisp
  ;; from Nicolas Richard <theonewiththeevillook@yahoo.fr>
  ;; Date: Fri, 8 Mar 2013 16:23:02 +0100
  ;; Message-ID: <87vc913oh5.fsf@yahoo.fr>
  (defun yf/org-electric-dollar nil
    "When called once, insert \\(\\) and leave point in between.
  When called twice, replace the previously inserted \\(\\) by one $."
    (interactive)
    (if (and (looking-at "\\\\)") (looking-back "\\\\("))
        (progn (delete-char 2)
               (delete-char -2)
               (insert "$"))
      (insert "\\(\\)")
      (backward-char 2)))
  (define-key org-mode-map (kbd "$") 'yf/org-electric-dollar)
#+end_src

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.6-425-gf4fca1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: Bug: parsing latex ``$\mathit{math}$'' in export [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
  2017-05-12 18:06   ` Joe Corneli
@ 2017-05-13  7:24     ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2017-05-13  7:24 UTC (permalink / raw)
  To: Joe Corneli; +Cc: Org-mode mailing list

Hello,

Joe Corneli <holtzermann17@gmail.com> writes:

> On Fri, May 12, 2017 at 4:37 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
>
>> I'm not convinced it is worth changing the syntax class of "'" or even
>> making a special case for "'". You can get rid of this problem using
>> \(P\) instead.
>
> Thanks for suggesting this work around, I didn't know that bit of
> syntax!

After sleeping over the idea, I eventually allowed the apostrophe after
$...$ as it was the case some time ago.

My suggestion still holds, though, as \(...\) syntax is much more
predictable than $...$.

By the way, instead of writing ``...'', you may be interested in
`org-export-with-smart-quotes' and use "..." instead.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2017-05-13  7:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-12 13:41 Bug: parsing latex ``$\mathit{math}$'' in export [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)] Joe Corneli
2017-05-12 15:37 ` Nicolas Goaziou
2017-05-12 18:06   ` Joe Corneli
2017-05-13  7:24     ` Nicolas Goaziou
     [not found]   ` <108e9a8cdc924e71afc3324c4bd4d1eb@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-05-12 18:57     ` Eric S Fraga

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