emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-use-sub-superscripts not working [8.2.3b (8.2.3b-elpa @ c:/Users/xxx/.emacs.d/elpa/org-20131112/)]
@ 2013-11-14 19:38 dieter
  2013-11-14 21:19 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: dieter @ 2013-11-14 19:38 UTC (permalink / raw)
  To: emacs-orgmode

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


hi list,
i am not sure whether i have discovered a bug or just using this not in
the right way.
i have an org document where i have lots of underscores in words (they
are function names, e.g. BC_send) and do not want them to be interpreted
as subscripts.
the documentation says that the variable org-use-sub-superscript can be
used to customize this behaviour:
- t..convert every underscore
- {}..only convert when text is preprended by an underscore and within
braces
- nil..no conversion at all
in my environment, this does not work. output is always the same.
i exported to html.
i have set the variable in my
.emacs. i have also tried without my defs with emacs -q --no-desktop.
i found a similar report on the list, where they tried #+OPTIONS, this does
also not fix
my problem.
finally i have wrote a little elisp file to programmatically reproduce
my situation, here it is:
------------cut-----------------------
(defun insert-version ()
  "insert org and emacs version information"
  (interactive)
  (insert (concat "emacs-version: " emacs-version "n"))
  (insert (concat "org-version: " org-version "n")))
(defun insert-org-text ()
  "insert some org text with sub and superscripts
and select the org text"
  (interactive)
  (insert (concat "nnorg-use-sub-superscripts: ")
            (if
                      (eq org-use-sub-superscripts t) "tn"
                  (if (eq org-use-sub-superscripts '{}) "{}n"
                          (if (eq org-use-sub-superscripts nil) "niln" "not
niln"))))
  (insert "plain underscore: X_sub 3^supern")
  (insert "braces          : X_{sub} 3^{super}n")
  (push-mark)
  (insert "plain underscore: X_sub 3^supern")
  (insert "braces          : X_{sub} 3^{super}n")
  (exchange-point-and-mark))
(progn
  (let ((orgfile "blaa.org"))
    (get-buffer-create orgfile)
    (set-buffer orgfile)
    (split-window-horizontally)
    (switch-to-buffer-other-window orgfile)
    (kill-region (point-min) (point-max))
    (org-mode)
    (insert-version)
    (setq values '(t {} nil))
    (while values
      (setq org-use-sub-superscripts (car values))
      (insert-org-text)
      (org-html-convert-region-to-html)
      (setq values (cdr values)))))
-------------cut---------
and here is my output:
-------------cut---------
emacs-version: 24.3.1
org-version: 8.2.3b
org-use-sub-superscripts: t
plain underscore: X_sub 3^super
braces          : X_{sub} 3^{super}

plain underscore: Xsub 3super
braces          : Xsub 3super
org-use-sub-superscripts: {}
plain underscore: X_sub 3^super
braces          : X_{sub} 3^{super}

plain underscore: Xsub 3super
braces          : Xsub 3super
org-use-sub-superscripts: nil
plain underscore: X_sub 3^super
braces          : X_{sub} 3^{super}

plain underscore: Xsub 3super
braces          : Xsub 3super

-------------cut---------
Emacs  : GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601)
 of 2013-03-17 on MARVIN
Package: Org-mode version 8.2.3b (8.2.3b-elpa @
c:/Users/atw113y5/AppData/Roaming/.emacs.d/elpa/org-20131112/)
current state:
==============
(setq
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
   org-babel-execute-safely-maybe)
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-tab-first-hook '(org-hide-block-toggle-maybe
       org-src-native-tab-command-maybe
       org-babel-hide-result-toggle-maybe
       org-babel-header-arg-expand)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
   org-cycle-hide-inline-tasks org-cycle-show-empty-lines
   org-optimize-window-after-visibility-change)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-speed-command-hook '(org-speed-command-default-hook
   org-babel-speed-command-hook)
 org-babel-pre-tangle-hook '(save-buffer)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-mode-hook '(#[nil "300301302303304S207"
    [org-add-hook change-major-mode-hook org-show-block-all
     append local]
    5]
  #[nil "300301302303304S207"
    [org-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-export-dispatch-use-expert-ui t
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
      org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-confirm-shell-link-function 'yes-or-no-p
 )


[-- Attachment #2: Type: text/html, Size: 13456 bytes --]

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

* Re: Bug: org-use-sub-superscripts not working [8.2.3b (8.2.3b-elpa @ c:/Users/xxx/.emacs.d/elpa/org-20131112/)]
  2013-11-14 19:38 Bug: org-use-sub-superscripts not working [8.2.3b (8.2.3b-elpa @ c:/Users/xxx/.emacs.d/elpa/org-20131112/)] dieter
@ 2013-11-14 21:19 ` Nick Dokos
  2013-11-15  9:10   ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2013-11-14 21:19 UTC (permalink / raw)
  To: emacs-orgmode

dieter@schoen.or.at writes:

> hi list,
> i am not sure whether i have discovered a bug or just using this not in
> the right way.
> i have an org document where i have lots of underscores in words (they
> are function names, e.g. BC_send) and do not want them to be interpreted
> as subscripts.
>
> the documentation says that the variable org-use-sub-superscript can be
> used to customize this behaviour:
> - t..convert every underscore
> - {}..only convert when text is preprended by an underscore and within braces
> - nil..no conversion at all
>
> in my environment, this does not work. output is always the same.
> i exported to html.
> i have set the variable in my
> .emacs. i have also tried without my defs with emacs -q --no-desktop.

The name of the variable is org-export-with-sub-superscripts. If you make
this change to your code below, it DTRT I think.  If you say

#+OPTIONS: ^:nil

that's the variable that is set. 

Maybe org-use-sub-superscripts is a remnant that should be deleted: not
sure why it is still around. I note that it is defined and used in
org.el, whereas org-export-with-sub-superscripts is defined and used in
ox.el.

>
> i found a similar report on the list, where they tried #+OPTIONS, this
> does also not fix my problem.

This *should* have fixed the problem though.

Nick

> finally i have wrote a little elisp file to programmatically reproduce
> my situation, here it is:
> ------------cut-----------------------
> (defun insert-version ()
>   "insert org and emacs version information"
>   (interactive)
>   (insert (concat "emacs-version: " emacs-version "\n"))
>   (insert (concat "org-version: " org-version "\n")))
>
> (defun insert-org-text ()
>   "insert some org text with sub and superscripts
> and select the org text"
>   (interactive)
>   (insert (concat "\n\norg-use-sub-superscripts: ")
>             (if
>                       (eq org-use-sub-superscripts t) "t\n"
>                   (if (eq org-use-sub-superscripts '{}) "{}\n"
>                           (if (eq org-use-sub-superscripts nil) "nil\n" "not nil\n"))))
>   (insert "plain underscore: X_sub 3^super\n")
>   (insert "braces          : X_{sub} 3^{super}\n")
>   (push-mark)
>   (insert "plain underscore: X_sub 3^super\n")
>   (insert "braces          : X_{sub} 3^{super}\n")
>   (exchange-point-and-mark))
>
> (progn
>   (let ((orgfile "blaa.org"))
>     (get-buffer-create orgfile)
>     (set-buffer orgfile)
>     (split-window-horizontally)
>     (switch-to-buffer-other-window orgfile)
>     (kill-region (point-min) (point-max))
>     (org-mode)
>     (insert-version)
>     (setq values '(t {} nil))
>     (while values
>       (setq org-use-sub-superscripts (car values))
>       (insert-org-text)
>       (org-html-convert-region-to-html)
>       (setq values (cdr values)))))
> -------------cut---------
> and here is my output:
> -------------cut---------
> ...

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

* Re: Bug: org-use-sub-superscripts not working [8.2.3b (8.2.3b-elpa @ c:/Users/xxx/.emacs.d/elpa/org-20131112/)]
  2013-11-14 21:19 ` Nick Dokos
@ 2013-11-15  9:10   ` Bastien
  0 siblings, 0 replies; 3+ messages in thread
From: Bastien @ 2013-11-15  9:10 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Hi,

Nick Dokos <ndokos@gmail.com> writes:

> Maybe org-use-sub-superscripts is a remnant that should be deleted: not
> sure why it is still around. I note that it is defined and used in
> org.el, whereas org-export-with-sub-superscripts is defined and used in
> ox.el.

AFAIU both have different meaning: `org-use-sub-superscripts' is for
controlling the display, while `org-export-with-sub-superscripts' is
for controlling the export.  I clarified the docstrings a bit.

-- 
 Bastien

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

end of thread, other threads:[~2013-11-15  9:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 19:38 Bug: org-use-sub-superscripts not working [8.2.3b (8.2.3b-elpa @ c:/Users/xxx/.emacs.d/elpa/org-20131112/)] dieter
2013-11-14 21:19 ` Nick Dokos
2013-11-15  9:10   ` Bastien

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