emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* leading superscript on a line for ODT export
@ 2022-03-16 11:23 Eric S Fraga
  2022-03-16 12:03 ` Juan Manuel Macías
  2022-03-16 13:46 ` Max Nikulin
  0 siblings, 2 replies; 12+ messages in thread
From: Eric S Fraga @ 2022-03-16 11:23 UTC (permalink / raw)
  To: Org Mode List

Dear all,

I need to have a line starting with a superscript, e.g. 1, in an ODT
exported file.  If I write "^1 blah", it doesn't work.  I need a
character before the ^ to have it interpreted as a superscript.

Is there an "empty" character I can use?  I tried a non-breaking space
but that did not work.  The space is there but the ^1 gets exported
literally.

Thank you,
eric
-- 
: Eric S Fraga, with org release_9.5.2-312-g5d05f5 in Emacs 29.0.50


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

* Re: leading superscript on a line for ODT export
  2022-03-16 11:23 leading superscript on a line for ODT export Eric S Fraga
@ 2022-03-16 12:03 ` Juan Manuel Macías
  2022-03-16 12:46   ` Eric S Fraga
  2022-03-16 13:46 ` Max Nikulin
  1 sibling, 1 reply; 12+ messages in thread
From: Juan Manuel Macías @ 2022-03-16 12:03 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: orgmode

Hi Eric,

Eric S Fraga writes:

> I need to have a line starting with a superscript, e.g. 1, in an ODT
> exported file.  If I write "^1 blah", it doesn't work.  I need a
> character before the ^ to have it interpreted as a superscript.
>
> Is there an "empty" character I can use?  I tried a non-breaking space
> but that did not work.  The space is there but the ^1 gets exported
> literally.

I would use a macro. For example:

#+begin_src emacs-lisp 
  (defun my-macro-superscript (arg)
     (cond ((eq org-export-current-backend 'latex)
	   (format "@@latex:\\textsuperscript{%s}@@" arg))
	  ((eq org-export-current-backend 'odt)
	   (format "@@odt:<text:span text:style-name=\"OrgSuperscript\">%s</text:span>@@" arg))))

  (setq org-export-global-macros
	'(("sup" . "(eval (my-macro-superscript $1))")))
#+end_src

{{{sup(4)}}}

Best regards,

Juan Manuel 


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

* Re: leading superscript on a line for ODT export
  2022-03-16 12:03 ` Juan Manuel Macías
@ 2022-03-16 12:46   ` Eric S Fraga
  2022-03-16 13:12     ` Juan Manuel Macías
  0 siblings, 1 reply; 12+ messages in thread
From: Eric S Fraga @ 2022-03-16 12:46 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

On Wednesday, 16 Mar 2022 at 12:03, Juan Manuel Macías wrote:
> I would use a macro. For example:

Yes, I guess this is the best way to do this.  Thank you in particular
for the xml code for odt which would have taken me some time to figure
out!

-- 
: Eric S Fraga, with org release_9.5.2-401-g91681f in Emacs 29.0.50


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

* Re: leading superscript on a line for ODT export
  2022-03-16 12:46   ` Eric S Fraga
@ 2022-03-16 13:12     ` Juan Manuel Macías
  2022-03-16 13:42       ` Eric S Fraga
  0 siblings, 1 reply; 12+ messages in thread
From: Juan Manuel Macías @ 2022-03-16 13:12 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: orgmode

Eric S Fraga writes:

> Yes, I guess this is the best way to do this.  Thank you in particular
> for the xml code for odt which would have taken me some time to figure
> out!

When I need to find out some xml markup in odt or docx I open the
document from Dired with view-mode, and run C-c C-c
(doc-view-toggle-display) to access the .xml files (these documents are
nothing more than zipped folders with xml files inside). This is also
useful for making (small) modifications to an odt or docx document. So,
yeah, in Emacs we can edit a Word or Libreoffice document :-D.

A screenshot: https://i.imgur.com/XRcGwse.png

Best regards,

Juan Manuel 


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

* Re: leading superscript on a line for ODT export
  2022-03-16 13:12     ` Juan Manuel Macías
@ 2022-03-16 13:42       ` Eric S Fraga
  0 siblings, 0 replies; 12+ messages in thread
From: Eric S Fraga @ 2022-03-16 13:42 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

On Wednesday, 16 Mar 2022 at 13:12, Juan Manuel Macías wrote:
> When I need to find out some xml markup in odt or docx I open the
> document from Dired with view-mode, and run C-c C-c

Yeah, I've done this in the past as well.  Dired and automatic
un-zipping really helps!

Thanks again,
eric

-- 
: Eric S Fraga, with org release_9.5.2-401-g91681f in Emacs 29.0.50


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

* Re: leading superscript on a line for ODT export
  2022-03-16 11:23 leading superscript on a line for ODT export Eric S Fraga
  2022-03-16 12:03 ` Juan Manuel Macías
@ 2022-03-16 13:46 ` Max Nikulin
  2022-03-16 14:00   ` Eric S Fraga
                     ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: Max Nikulin @ 2022-03-16 13:46 UTC (permalink / raw)
  To: emacs-orgmode

On 16/03/2022 18:23, Eric S Fraga wrote:
> 
> I need to have a line starting with a superscript, e.g. 1, in an ODT
> exported file.  If I write "^1 blah", it doesn't work.  I need a
> character before the ^ to have it interpreted as a superscript.
> 
> Is there an "empty" character I can use?  I tried a non-breaking space
> but that did not work.  The space is there but the ^1 gets exported
> literally.

     @@org:@@^1 blah



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

* Re: leading superscript on a line for ODT export
  2022-03-16 13:46 ` Max Nikulin
@ 2022-03-16 14:00   ` Eric S Fraga
  2022-03-16 14:04   ` Greg Minshall
  2022-03-16 14:07   ` Juan Manuel Macías
  2 siblings, 0 replies; 12+ messages in thread
From: Eric S Fraga @ 2022-03-16 14:00 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

On Wednesday, 16 Mar 2022 at 20:46, Max Nikulin wrote:
>     @@org:@@^1 blah

cute!  works very well.  Thank you.

-- 
: Eric S Fraga, with org release_9.5.2-401-g91681f in Emacs 29.0.50


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

* Re: leading superscript on a line for ODT export
  2022-03-16 13:46 ` Max Nikulin
  2022-03-16 14:00   ` Eric S Fraga
@ 2022-03-16 14:04   ` Greg Minshall
  2022-03-16 14:54     ` Eric S Fraga
  2022-03-16 15:15     ` Max Nikulin
  2022-03-16 14:07   ` Juan Manuel Macías
  2 siblings, 2 replies; 12+ messages in thread
From: Greg Minshall @ 2022-03-16 14:04 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

hi.

>     @@org:@@^1 blah

i'm not familiar with the '@@' construct.  in the manual, searching for
the string "@@", i see references to various =@@foo...=, but not, for
example, =@@org:@@=.

is there a general definition?  might the index (or, one of the indices)
usefully have references to various "special" characters (like "^", "|",
and "@" when used in TODOs, iiuc)?

cheers, Greg


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

* Re: leading superscript on a line for ODT export
  2022-03-16 13:46 ` Max Nikulin
  2022-03-16 14:00   ` Eric S Fraga
  2022-03-16 14:04   ` Greg Minshall
@ 2022-03-16 14:07   ` Juan Manuel Macías
  2 siblings, 0 replies; 12+ messages in thread
From: Juan Manuel Macías @ 2022-03-16 14:07 UTC (permalink / raw)
  To: Max Nikulin; +Cc: orgmode, Eric S Fraga

Max Nikulin writes:

>     @@org:@@^1 blah

This is a nice solution. I think a snipet with a "non-existent" backend
would work here too:

@@null:@@^1

(I use a lot export snipets with 'non-existent' backends for inline
comments).

Best regards,

Juan Manuel 


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

* Re: leading superscript on a line for ODT export
  2022-03-16 14:04   ` Greg Minshall
@ 2022-03-16 14:54     ` Eric S Fraga
  2022-03-16 15:15     ` Max Nikulin
  1 sibling, 0 replies; 12+ messages in thread
From: Eric S Fraga @ 2022-03-16 14:54 UTC (permalink / raw)
  To: Greg Minshall; +Cc: Max Nikulin, emacs-orgmode

On Wednesday, 16 Mar 2022 at 07:04, Greg Minshall wrote:
> i'm not familiar with the '@@' construct.  in the manual, searching for
> the string "@@", i see references to various =@@foo...=, but not, for
> example, =@@org:@@=.
>
> is there a general definition?  

The general definition is @@target:code@@ where target is an export
engine, e.g. LaTeX, beamer, ODT, HTML, etc., and code is the actual text
to export "as is" when exporting to that target, i.e. it is not
interpreted by org and simply passes through.

This feature can be very useful (read: necessary) to tweak the behaviour
of the final exported output.

If the manual needs updating, and I'm sure it does, we always welcome
patches!

-- 
: Eric S Fraga, with org release_9.5.2-401-g91681f in Emacs 29.0.50


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

* Re: leading superscript on a line for ODT export
  2022-03-16 14:04   ` Greg Minshall
  2022-03-16 14:54     ` Eric S Fraga
@ 2022-03-16 15:15     ` Max Nikulin
  2022-03-17  0:32       ` Greg Minshall
  1 sibling, 1 reply; 12+ messages in thread
From: Max Nikulin @ 2022-03-16 15:15 UTC (permalink / raw)
  To: emacs-orgmode

On 16/03/2022 21:04, Greg Minshall wrote:
> hi.
> 
>>      @@org:@@^1 blah
> 
> i'm not familiar with the '@@' construct.  in the manual, searching for
> the string "@@", i see references to various =@@foo...=, but not, for
> example, =@@org:@@=.
> 
> is there a general definition?  might the index (or, one of the indices)
> usefully have references to various "special" characters (like "^", "|",
> and "@" when used in TODOs, iiuc)?

I have not found definition of export snippet in the manual as well, so:
https://orgmode.org/worg/dev/org-syntax.html#Export_Snippets

It is an export snippet that is expanded to nothing and "org" is the 
backend name (alphanumeric characters). I choose "org" for two reasons:
- `org-lint' might report unknown backend (it does not do it currently 
though and `ox-org' is not loaded by default)
- perfect solution should survive after export to org. From my point of 
view, it is a bug in `ox-org' that it ignores @@org:...@@ (and other) 
export snippets. My expectation that they should be copied verbatim to 
allow further export to arbitrary format.

So the main problem with

     @@org:@@^1 one

that it would not work after export to org.

Another solution:

     #+options: broken-links:t

     [[#not-found][{}]^2 two

It works but the price is that really broken links may remain unnoticed.

A custom entity may be better:

     #+begin_src elisp :exports (if (org-export-derived-backend-p 
org-export-current-backend 'org) "sources" "results") :results silent
       (setq org-entities-user '(("relax" "" nil "" "" "")))
     #+end_src

     \relax^3 three

Actually all these recipes are the outcome of flame in the threads about 
intra-word markup. Notice that a macro expanded to empty string does not 
work.

P.S. Juan Manuel, I was expecting that you suggested a custom link:

     #+begin_src elisp :exports (if (org-export-derived-backend-p 
org-export-current-backend 'org) "sources" "results") :results silent
       (org-link-set-parameters
        "discard"
        :export (lambda (_path _descr _backend) ""))
     #+end_src

     [[discard:][{}]]^5 four



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

* Re: leading superscript on a line for ODT export
  2022-03-16 15:15     ` Max Nikulin
@ 2022-03-17  0:32       ` Greg Minshall
  0 siblings, 0 replies; 12+ messages in thread
From: Greg Minshall @ 2022-03-17  0:32 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max and Eric, thanks for the explanation!  "hmm...", about manual
patches at the moment.


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

end of thread, other threads:[~2022-03-17  0:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 11:23 leading superscript on a line for ODT export Eric S Fraga
2022-03-16 12:03 ` Juan Manuel Macías
2022-03-16 12:46   ` Eric S Fraga
2022-03-16 13:12     ` Juan Manuel Macías
2022-03-16 13:42       ` Eric S Fraga
2022-03-16 13:46 ` Max Nikulin
2022-03-16 14:00   ` Eric S Fraga
2022-03-16 14:04   ` Greg Minshall
2022-03-16 14:54     ` Eric S Fraga
2022-03-16 15:15     ` Max Nikulin
2022-03-17  0:32       ` Greg Minshall
2022-03-16 14:07   ` Juan Manuel Macías

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