emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Q] How to italicize without introducing a space?
@ 2023-03-29  3:12 Ruijie Yu via General discussions about Org-mode.
  2023-03-29  6:06 ` Dr. Arne Babenhauserheide
  2023-03-29  8:15 ` Marcin Borkowski
  0 siblings, 2 replies; 5+ messages in thread
From: Ruijie Yu via General discussions about Org-mode. @ 2023-03-29  3:12 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I am working on a piece of CJK text, which requires italicization.

--8<---------------cut here---------------start------------->8---
任何一个章节可以通过增加例如 =TODO= 或者 =HOLD= 等关键词来被设置成 /待办/ 。
--8<---------------cut here---------------end--------------->8---

Note the spaces before and after the pair of `?/'.  Without these
spaces, the HTML export does not show "待办" as italicized, but instead
treat them as inline literal `?/' characters, which is expected in
current Org implementation.

Also note that -- unlike English -- Chinese sentences rarely use spaces
(if at all), so showing the space simply because the Org grammar needs
it seems unnatural.

However, I don't immediately see how to resolve the issue natively in
Org.  If we allow `?/' to italicize regardless of spaces, then things
like Unix paths would no longer work.

So, I came up with using LaTeX like this:

--8<---------------cut here---------------start------------->8---
任何一个章节可以通过增加例如 =TODO= 或者 =HOLD= 等关键词来被设置成\(\textit{待办}\)。
--8<---------------cut here---------------end--------------->8---

This has two drawbacks:
1. (network-related?) Delay.  Apparently HTML uses MathJax to render
LaTeX, and my browser experiences a 1-second delay due to it needing to
download JS code from MathJax and doing some processing.
2. Transferability.  This only resolves the issue of /italicization/.
What if I need to underscore or bold a piece of text (likely), or to add
an inline code block with CJK characters (unlikely)?  I would have to
search for how to do each in LaTeX and write the workaround accordingly,
instead of simply using the Org markup syntax for each of them.

Are there any other solutions than what I have currently?

-- 
Best,


RY


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

* Re: [Q] How to italicize without introducing a space?
  2023-03-29  3:12 [Q] How to italicize without introducing a space? Ruijie Yu via General discussions about Org-mode.
@ 2023-03-29  6:06 ` Dr. Arne Babenhauserheide
  2023-03-29  6:18   ` Ruijie Yu via General discussions about Org-mode.
  2023-03-29  8:15 ` Marcin Borkowski
  1 sibling, 1 reply; 5+ messages in thread
From: Dr. Arne Babenhauserheide @ 2023-03-29  6:06 UTC (permalink / raw)
  To: Ruijie Yu; +Cc: emacs-orgmode

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

Hello,

Ruijie Yu via "General discussions about Org-mode." <emacs-orgmode@gnu.org> writes:

> Hello,
>
> I am working on a piece of CJK text, which requires italicization.
>
> 任何一个章节可以通过增加例如 =TODO= 或者 =HOLD= 等关键词来被设置成 /待办/ 。
>
>
> Note the spaces before and after the pair of `?/'.
> Are there any other solutions than what I have currently?

You could try using a ZERO WIDTH SPACE around the expression, like this:

任何一个章节可以通过增加例如 =TODO= 或者 =HOLD= 等关键词来被设置成​/待办/​

You can insert it with M-x insert-char RET ZERO WIDTH SPACE

I’m not sure how well it works with the different export backends,
though. For LaTeX you may need to define the right way to export it with

#+latex_header: \DeclareUnicodeCharacter{200B}{\allowbreak }

(if you want to allow linebreaks here, otherwise a better fitting LaTeX
command that does not look like a space)

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

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

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

* Re: [Q] How to italicize without introducing a space?
  2023-03-29  6:06 ` Dr. Arne Babenhauserheide
@ 2023-03-29  6:18   ` Ruijie Yu via General discussions about Org-mode.
  2023-03-29  7:05     ` Dr. Arne Babenhauserheide
  0 siblings, 1 reply; 5+ messages in thread
From: Ruijie Yu via General discussions about Org-mode. @ 2023-03-29  6:18 UTC (permalink / raw)
  To: Dr. Arne Babenhauserheide; +Cc: emacs-orgmode, Steven Harris


"Dr. Arne Babenhauserheide" <arne_bab@web.de> writes:

> [...]
> You could try using a ZERO WIDTH SPACE around the expression [...]

Thank you Arne and Steven.  I have tried to just insert the zero width
space, and it seems to work very well (at least on HTML export, which is
the only backend that orgweb wants, because I'm working on a translation
for it).

I do realize that LaTeX export may struggle with zero width space, but
I'll only look into it when it becomes a problem.

--
Best,


RY


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

* Re: [Q] How to italicize without introducing a space?
  2023-03-29  6:18   ` Ruijie Yu via General discussions about Org-mode.
@ 2023-03-29  7:05     ` Dr. Arne Babenhauserheide
  0 siblings, 0 replies; 5+ messages in thread
From: Dr. Arne Babenhauserheide @ 2023-03-29  7:05 UTC (permalink / raw)
  To: Ruijie Yu; +Cc: emacs-orgmode, Steven Harris

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


Ruijie Yu <ruijie@netyu.xyz> writes:

> "Dr. Arne Babenhauserheide" <arne_bab@web.de> writes:
>
>> [...]
>> You could try using a ZERO WIDTH SPACE around the expression [...]
>
> Thank you Arne and Steven.  I have tried to just insert the zero width
> space, and it seems to work very well (at least on HTML export, which is
> the only backend that orgweb wants, because I'm working on a translation
> for it).

You’re welcome!

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

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

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

* Re: [Q] How to italicize without introducing a space?
  2023-03-29  3:12 [Q] How to italicize without introducing a space? Ruijie Yu via General discussions about Org-mode.
  2023-03-29  6:06 ` Dr. Arne Babenhauserheide
@ 2023-03-29  8:15 ` Marcin Borkowski
  1 sibling, 0 replies; 5+ messages in thread
From: Marcin Borkowski @ 2023-03-29  8:15 UTC (permalink / raw)
  To: Ruijie Yu; +Cc: emacs-orgmode


On 2023-03-29, at 05:12, Ruijie Yu via General discussions about Org-mode. <emacs-orgmode@gnu.org> wrote:

> Hello,
>
> I am working on a piece of CJK text, which requires italicization.
>
> --8<---------------cut here---------------start------------->8---
> 任何一个章节可以通过增加例如 =TODO= 或者 =HOLD= 等关键词来被设置成 /待办/ 。
> --8<---------------cut here---------------end--------------->8---
>
> Note the spaces before and after the pair of `?/'.  Without these
> spaces, the HTML export does not show "待办" as italicized, but instead
> treat them as inline literal `?/' characters, which is expected in
> current Org implementation.
>
> Also note that -- unlike English -- Chinese sentences rarely use spaces
> (if at all), so showing the space simply because the Org grammar needs
> it seems unnatural.
>
> However, I don't immediately see how to resolve the issue natively in
> Org.  If we allow `?/' to italicize regardless of spaces, then things
> like Unix paths would no longer work.
>
> So, I came up with using LaTeX like this:
>
> --8<---------------cut here---------------start------------->8---
> 任何一个章节可以通过增加例如 =TODO= 或者 =HOLD= 等关键词来被设置成\(\textit{待办}\)。
> --8<---------------cut here---------------end--------------->8---
>
> This has two drawbacks:
> 1. (network-related?) Delay.  Apparently HTML uses MathJax to render
> LaTeX, and my browser experiences a 1-second delay due to it needing to
> download JS code from MathJax and doing some processing.
> 2. Transferability.  This only resolves the issue of /italicization/.
> What if I need to underscore or bold a piece of text (likely), or to add
> an inline code block with CJK characters (unlikely)?  I would have to
> search for how to do each in LaTeX and write the workaround accordingly,
> instead of simply using the Org markup syntax for each of them.
>
> Are there any other solutions than what I have currently?

My go-to solution (and not only mine, I guess) is to use a zero-width
space.  I even have a command to do this:

(defun insert-zero-width-space ()
  "Insert Unicode character \"zero-width space\"."
  (interactive)
  (insert 8203))

Hth,

-- 
Marcin Borkowski
http://mbork.pl


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

end of thread, other threads:[~2023-03-29  8:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29  3:12 [Q] How to italicize without introducing a space? Ruijie Yu via General discussions about Org-mode.
2023-03-29  6:06 ` Dr. Arne Babenhauserheide
2023-03-29  6:18   ` Ruijie Yu via General discussions about Org-mode.
2023-03-29  7:05     ` Dr. Arne Babenhauserheide
2023-03-29  8:15 ` Marcin Borkowski

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