all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Smart quotes not working correctly with single quotes
@ 2021-05-28  2:54 Andreas Gösele
  2021-05-28 10:10 ` Juan Manuel Macías
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Gösele @ 2021-05-28  2:54 UTC (permalink / raw)
  To: Emacs-orgmode

Hi,

even using "smart quotes", single quotes are not correctly exported into
html, odt or latex.

I have as document:

| #+LANGUAGE: de
| #+OPTIONS: ':t
| #+OPTIONS: toc:nil
| It's a 'test'. "Please".

If I export it to html I get:

| It’s a ’test’. „Please“.

I should get:

| It’s a ‚test‘. „Please“.

If I export to latex I get:

| It's a 'test'. "`Please"'.

I should get:

| It's a \glq{}test\grq{}. "`Please"'.

If I export to odt I get:

| It’s a ’test’. „Please“.

I should get:

| It’s a ‚test‘. „Please“.

(The odt example outputs use utf8, I hope it gets transmitted.)

So in all three cases apostrophes and double quotes are correctly
exported, but not single quotes. Similar problem if I use "#+LANGUAGE:
en".

I have org-mode 9.3 with emacs 27.1.

What could I do to get single quotes to be exported correctly?

Thanks a lot!

Andreas


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28  2:54 Smart quotes not working correctly with single quotes Andreas Gösele
@ 2021-05-28 10:10 ` Juan Manuel Macías
  2021-05-28 15:42   ` Andreas Gösele
  0 siblings, 1 reply; 14+ messages in thread
From: Juan Manuel Macías @ 2021-05-28 10:10 UTC (permalink / raw)
  To: Andreas Gösele; +Cc: orgmode

Hi Andreas,

I don't know if this is a bug, but I would say that in principle it's
the expected result. Single quotes are understood here as inner quotes
or second-level quotation marks, therefore they are only activated
nested in text with first level quotes: " ... '...' ... "

lorem "ipsum 'dolor sit' amet"

For LaTeX output, however, the csquotes package is a more powerful
option to control the correct quotation marks for each language. For
example:

#+LaTeX_Header: \usepackage[german,english]{babel}
#+LaTeX_Header: \usepackage[babel=true,autostyle=true,german=quotes]{csquotes}
#+LaTeX_Header: \MakeOuterQuote{"}
#+LaTeX_Header: \MakeInnerQuote{´}
#+LaTeX: \selectlanguage{german}\EnableQuotes
It's a ´test´. "Please".
lorem "ipsum ´dolor´ sit" amet

Best regards,

Juan Manuel 

Andreas Gösele writes:

> Hi,
>
> even using "smart quotes", single quotes are not correctly exported into
> html, odt or latex.
>
> I have as document:
>
> | #+LANGUAGE: de
> | #+OPTIONS: ':t
> | #+OPTIONS: toc:nil
> | It's a 'test'. "Please".
>
> If I export it to html I get:
>
> | It’s a ’test’. „Please“.
>
> I should get:
>
> | It’s a ‚test‘. „Please“.
>
> If I export to latex I get:
>
> | It's a 'test'. "`Please"'.
>
> I should get:
>
> | It's a \glq{}test\grq{}. "`Please"'.
>
> If I export to odt I get:
>
> | It’s a ’test’. „Please“.
>
> I should get:
>
> | It’s a ‚test‘. „Please“.
>
> (The odt example outputs use utf8, I hope it gets transmitted.)
>
> So in all three cases apostrophes and double quotes are correctly
> exported, but not single quotes. Similar problem if I use "#+LANGUAGE:
> en".
>
> I have org-mode 9.3 with emacs 27.1.
>
> What could I do to get single quotes to be exported correctly?
>
> Thanks a lot!
>
> Andreas
>



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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 10:10 ` Juan Manuel Macías
@ 2021-05-28 15:42   ` Andreas Gösele
  2021-05-28 17:02     ` Juan Manuel Macías
                       ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Andreas Gösele @ 2021-05-28 15:42 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Thanks Juan Manuel!

Your suggestion works for LaTeX, but I need the other formats too. I
tried to convert the LaTeX document with pandoc, tex4h and latex2html to
odt and html but none of them produces the correct output.

So I'm wondering whether there is any way to make org export to
recognize single quotes also outside from double quote. It should be
possible as inner quotes is not the only use of simple quotes.

Thanks again!

Andreas

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Hi Andreas,
>
> I don't know if this is a bug, but I would say that in principle it's
> the expected result. Single quotes are understood here as inner quotes
> or second-level quotation marks, therefore they are only activated
> nested in text with first level quotes: " ... '...' ... "
>
> lorem "ipsum 'dolor sit' amet"
>
> For LaTeX output, however, the csquotes package is a more powerful
> option to control the correct quotation marks for each language. For
> example:
>
> #+LaTeX_Header: \usepackage[german,english]{babel}
> #+LaTeX_Header: \usepackage[babel=true,autostyle=true,german=quotes]{csquotes}
> #+LaTeX_Header: \MakeOuterQuote{"}
> #+LaTeX_Header: \MakeInnerQuote{´}
>
> #+LaTeX: \selectlanguage{german}\EnableQuotes
> It's a ´test´. "Please".
>
> lorem "ipsum ´dolor´ sit" amet
>
> Best regards,
>
> Juan Manuel 
>
> Andreas Gösele writes:
>
>> Hi,
>>
>> even using "smart quotes", single quotes are not correctly exported into
>> html, odt or latex.
>>
>> I have as document:
>>
>> | #+LANGUAGE: de
>> | #+OPTIONS: ':t
>> | #+OPTIONS: toc:nil
>> | It's a 'test'. "Please".
>>
>> If I export it to html I get:
>>
>> | It&rsquo;s a &rsquo;test&rsquo;. &bdquo;Please&ldquo;.
>>
>> I should get:
>>
>> | It&rsquo;s a &sbquo;test&lsquo;. &bdquo;Please&ldquo;.
>>
>> If I export to latex I get:
>>
>> | It's a 'test'. "`Please"'.
>>
>> I should get:
>>
>> | It's a \glq{}test\grq{}. "`Please"'.
>>
>> If I export to odt I get:
>>
>> | It’s a ’test’. „Please“.
>>
>> I should get:
>>
>> | It’s a ‚test‘. „Please“.
>>
>> (The odt example outputs use utf8, I hope it gets transmitted.)
>>
>> So in all three cases apostrophes and double quotes are correctly
>> exported, but not single quotes. Similar problem if I use "#+LANGUAGE:
>> en".
>>
>> I have org-mode 9.3 with emacs 27.1.
>>
>> What could I do to get single quotes to be exported correctly?
>>
>> Thanks a lot!
>>
>> Andreas
>>


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 15:42   ` Andreas Gösele
@ 2021-05-28 17:02     ` Juan Manuel Macías
  2021-05-28 20:27       ` Andreas Gösele
  2021-05-28 17:20     ` Nicolas Goaziou
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Juan Manuel Macías @ 2021-05-28 17:02 UTC (permalink / raw)
  To: Andreas Gösele; +Cc: orgmode

Hi Andreas,

A quick fix (for LaTeX, odt and HTML), if you want to use second-level
quotes as first-level quotes in parts of your document, could be to
define a filter. You must put these quotes as ´ ... ´ (for example):

#+LANGUAGE: de
#+OPTIONS: ':t

#+BIND: org-export-filter-final-output-functions (single-quote-filter)
    #+begin_src emacs-lisp :exports results :results none
      (defun single-quote-filter (text backend info)
	(cond ((or (org-export-derived-backend-p backend 'html)
		   (org-export-derived-backend-p backend 'odt))
	       (replace-regexp-in-string "´\\([[:graph:]]+\\)" "‚\\1"
					 (replace-regexp-in-string "\\([[:graph:]]+\\)´" "\\1‘"
								   text)))
	      ((org-export-derived-backend-p backend 'latex)
	       (replace-regexp-in-string "´\\([[:graph:]]+\\)" "‚\\\\glq{}\\1"
					 (replace-regexp-in-string "\\([[:graph:]]+\\)´" "\\1\\\\grq{}"
								   text)))))
    #+end_src

It's a ´test´. "Please".

Best regards,

Juan Manuel 

Andreas Gösele writes:

> Thanks Juan Manuel!
>
> Your suggestion works for LaTeX, but I need the other formats too. I
> tried to convert the LaTeX document with pandoc, tex4h and latex2html to
> odt and html but none of them produces the correct output.
>
> So I'm wondering whether there is any way to make org export to
> recognize single quotes also outside from double quote. It should be
> possible as inner quotes is not the only use of simple quotes.
>
> Thanks again!
>
> Andreas
>
> Juan Manuel Macías <maciaschain@posteo.net> writes:
>
>> Hi Andreas,
>>
>> I don't know if this is a bug, but I would say that in principle it's
>> the expected result. Single quotes are understood here as inner quotes
>> or second-level quotation marks, therefore they are only activated
>> nested in text with first level quotes: " ... '...' ... "
>>
>> lorem "ipsum 'dolor sit' amet"
>>
>> For LaTeX output, however, the csquotes package is a more powerful
>> option to control the correct quotation marks for each language. For
>> example:
>>
>> #+LaTeX_Header: \usepackage[german,english]{babel}
>> #+LaTeX_Header: \usepackage[babel=true,autostyle=true,german=quotes]{csquotes}
>> #+LaTeX_Header: \MakeOuterQuote{"}
>> #+LaTeX_Header: \MakeInnerQuote{´}
>>
>> #+LaTeX: \selectlanguage{german}\EnableQuotes
>> It's a ´test´. "Please".
>>
>> lorem "ipsum ´dolor´ sit" amet
>>
>> Best regards,
>>
>> Juan Manuel 
>>
>> Andreas Gösele writes:
>>
>>> Hi,
>>>
>>> even using "smart quotes", single quotes are not correctly exported into
>>> html, odt or latex.
>>>
>>> I have as document:
>>>
>>> | #+LANGUAGE: de
>>> | #+OPTIONS: ':t
>>> | #+OPTIONS: toc:nil
>>> | It's a 'test'. "Please".
>>>
>>> If I export it to html I get:
>>>
>>> | It&rsquo;s a &rsquo;test&rsquo;. &bdquo;Please&ldquo;.
>>>
>>> I should get:
>>>
>>> | It&rsquo;s a &sbquo;test&lsquo;. &bdquo;Please&ldquo;.
>>>
>>> If I export to latex I get:
>>>
>>> | It's a 'test'. "`Please"'.
>>>
>>> I should get:
>>>
>>> | It's a \glq{}test\grq{}. "`Please"'.
>>>
>>> If I export to odt I get:
>>>
>>> | It’s a ’test’. „Please“.
>>>
>>> I should get:
>>>
>>> | It’s a ‚test‘. „Please“.
>>>
>>> (The odt example outputs use utf8, I hope it gets transmitted.)
>>>
>>> So in all three cases apostrophes and double quotes are correctly
>>> exported, but not single quotes. Similar problem if I use "#+LANGUAGE:
>>> en".
>>>
>>> I have org-mode 9.3 with emacs 27.1.
>>>
>>> What could I do to get single quotes to be exported correctly?
>>>
>>> Thanks a lot!
>>>
>>> Andreas
>>>



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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 15:42   ` Andreas Gösele
  2021-05-28 17:02     ` Juan Manuel Macías
@ 2021-05-28 17:20     ` Nicolas Goaziou
  2021-05-28 17:55     ` Albert Krewinkel
  2021-05-28 19:48     ` Nicolas Goaziou
  3 siblings, 0 replies; 14+ messages in thread
From: Nicolas Goaziou @ 2021-05-28 17:20 UTC (permalink / raw)
  To: Andreas Gösele; +Cc: Juan Manuel Macías, orgmode

Hello,

"Andreas Gösele" <agoesele@sju.edu> writes:

> So I'm wondering whether there is any way to make org export to
> recognize single quotes also outside from double quote. It should be
> possible as inner quotes is not the only use of simple quotes.

As Juan Manual Macías wrote, I confirm single quotes are only recognized
as second level quotes, i.e., nested within double quotes, or as
apostrophes.

Also, "smart" quotes use some gross heuristics that cannot handle all
situations. So, if you have very specific needs, you probably have to
disable them entirely.

Regards,
-- 
Nicolas Goaziou


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 15:42   ` Andreas Gösele
  2021-05-28 17:02     ` Juan Manuel Macías
  2021-05-28 17:20     ` Nicolas Goaziou
@ 2021-05-28 17:55     ` Albert Krewinkel
  2021-05-28 21:39       ` Andreas Gösele
  2021-05-28 19:48     ` Nicolas Goaziou
  3 siblings, 1 reply; 14+ messages in thread
From: Albert Krewinkel @ 2021-05-28 17:55 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Juan Manuel =?utf-8?Q?Mac=C3=ADas?=


Andreas Gösele <agoesele@sju.edu> writes:

> [...] I tried to convert the LaTeX document with pandoc, tex4h and
> latex2html to odt and html but none of them produces the correct
> output.
>
> So I'm wondering whether there is any way to make org export to
> recognize single quotes also outside from double quote. It should be
> possible as inner quotes is not the only use of simple quotes.

I apologize for the non-Emacs solution, but you can use pandoc in
combination with the following Lua filter to get the desired result:
https://github.com/pandoc/lua-filters/tree/master/pandoc-quotes.lua
For LaTeX output, you can also pass -Vcsquotes as a parameter to force
pandoc to make use of the csquotes package. Both should give you the
desired results.

HTH


> Juan Manuel Macías <maciaschain@posteo.net> writes:
>
>> Hi Andreas,
>>
>> I don't know if this is a bug, but I would say that in principle it's
>> the expected result. Single quotes are understood here as inner quotes
>> or second-level quotation marks, therefore they are only activated
>> nested in text with first level quotes: " ... '...' ... "
>>
>> lorem "ipsum 'dolor sit' amet"
>>
>> For LaTeX output, however, the csquotes package is a more powerful
>> option to control the correct quotation marks for each language. For
>> example:
>>
>> #+LaTeX_Header: \usepackage[german,english]{babel}
>> #+LaTeX_Header: \usepackage[babel=true,autostyle=true,german=quotes]{csquotes}
>> #+LaTeX_Header: \MakeOuterQuote{"}
>> #+LaTeX_Header: \MakeInnerQuote{´}
>>
>> #+LaTeX: \selectlanguage{german}\EnableQuotes
>> It's a ´test´. "Please".
>>
>> lorem "ipsum ´dolor´ sit" amet
>>
>> Best regards,
>>
>> Juan Manuel
>>
>> Andreas Gösele writes:
>>
>>> Hi,
>>>
>>> even using "smart quotes", single quotes are not correctly exported into
>>> html, odt or latex.
>>>
>>> I have as document:
>>>
>>> | #+LANGUAGE: de
>>> | #+OPTIONS: ':t
>>> | #+OPTIONS: toc:nil
>>> | It's a 'test'. "Please".
>>>
>>> If I export it to html I get:
>>>
>>> | It&rsquo;s a &rsquo;test&rsquo;. &bdquo;Please&ldquo;.
>>>
>>> I should get:
>>>
>>> | It&rsquo;s a &sbquo;test&lsquo;. &bdquo;Please&ldquo;.
>>>
>>> If I export to latex I get:
>>>
>>> | It's a 'test'. "`Please"'.
>>>
>>> I should get:
>>>
>>> | It's a \glq{}test\grq{}. "`Please"'.
>>>
>>> If I export to odt I get:
>>>
>>> | It’s a ’test’. „Please“.
>>>
>>> I should get:
>>>
>>> | It’s a ‚test‘. „Please“.
>>>
>>> (The odt example outputs use utf8, I hope it gets transmitted.)
>>>
>>> So in all three cases apostrophes and double quotes are correctly
>>> exported, but not single quotes. Similar problem if I use "#+LANGUAGE:
>>> en".
>>>
>>> I have org-mode 9.3 with emacs 27.1.
>>>
>>> What could I do to get single quotes to be exported correctly?
>>>
>>> Thanks a lot!
>>>
>>> Andreas
>>>


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 15:42   ` Andreas Gösele
                       ` (2 preceding siblings ...)
  2021-05-28 17:55     ` Albert Krewinkel
@ 2021-05-28 19:48     ` Nicolas Goaziou
  2021-05-28 20:19       ` Juan Manuel Macías
  2021-05-28 21:06       ` Andreas Gösele
  3 siblings, 2 replies; 14+ messages in thread
From: Nicolas Goaziou @ 2021-05-28 19:48 UTC (permalink / raw)
  To: Andreas Gösele; +Cc: Juan Manuel Macías, orgmode

"Andreas Gösele" <agoesele@sju.edu> writes:

> So I'm wondering whether there is any way to make org export to
> recognize single quotes also outside from double quote. It should be
> possible as inner quotes is not the only use of simple quotes.

Genuine question: what language uses two different styles of outer
(level 1) quotes? And in what context?


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 19:48     ` Nicolas Goaziou
@ 2021-05-28 20:19       ` Juan Manuel Macías
  2021-05-28 21:06       ` Andreas Gösele
  1 sibling, 0 replies; 14+ messages in thread
From: Juan Manuel Macías @ 2021-05-28 20:19 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

Hi Nicholas,

Nicolas Goaziou writes:

> Genuine question: what language uses two different styles of outer
> (level 1) quotes? And in what context?

I answer in the case of Spanish. In Spanish the level 1 quotes are «»
(french quotes). The level 2 are “...” (english quotes). Only in some
cases, and according to some writers and manuals, single quotation marks
‘...’ are correct as 1 level quotes (left single quotation mark ...
right single quotation mark), in short segments, generally when you want
to indicate the translation of a term. i.e.:

car (‘coche’)

Anyway, in Spanish it is not correct to use second level quotes “...” as
first-level quotes. I do not know if it is correct in German.

Best regards,

Juan Manuel 


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 17:02     ` Juan Manuel Macías
@ 2021-05-28 20:27       ` Andreas Gösele
  2021-05-28 20:37         ` Juan Manuel Macías
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Gösele @ 2021-05-28 20:27 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Thanks Juan Manuel!

I tried it, but it doesn't work. It leaves the simple quotes
untouched. Did you test it and did it work then?

Best regards,

Andreas

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Hi Andreas,
>
> A quick fix (for LaTeX, odt and HTML), if you want to use second-level
> quotes as first-level quotes in parts of your document, could be to
> define a filter. You must put these quotes as ´ ... ´ (for example):
>
> #+LANGUAGE: de
> #+OPTIONS: ':t
>
> #+BIND: org-export-filter-final-output-functions (single-quote-filter)
>     #+begin_src emacs-lisp :exports results :results none
>
>       (defun single-quote-filter (text backend info)
> 	(cond ((or (org-export-derived-backend-p backend 'html)
> 		   (org-export-derived-backend-p backend 'odt))
> 	       (replace-regexp-in-string "´\\([[:graph:]]+\\)" "‚\\1"
> 					 (replace-regexp-in-string "\\([[:graph:]]+\\)´" "\\1‘"
> 								   text)))
> 	      ((org-export-derived-backend-p backend 'latex)
> 	       (replace-regexp-in-string "´\\([[:graph:]]+\\)" "‚\\\\glq{}\\1"
> 					 (replace-regexp-in-string "\\([[:graph:]]+\\)´" "\\1\\\\grq{}"
> 								   text)))))
>     #+end_src
>
> It's a ´test´. "Please".
>
> Best regards,
>
> Juan Manuel 
>
> Andreas Gösele writes:
>
>> Thanks Juan Manuel!
>>
>> Your suggestion works for LaTeX, but I need the other formats too. I
>> tried to convert the LaTeX document with pandoc, tex4h and latex2html to
>> odt and html but none of them produces the correct output.
>>
>> So I'm wondering whether there is any way to make org export to
>> recognize single quotes also outside from double quote. It should be
>> possible as inner quotes is not the only use of simple quotes.
>>
>> Thanks again!
>>
>> Andreas
>>
>> Juan Manuel Macías <maciaschain@posteo.net> writes:
>>
>>> Hi Andreas,
>>>
>>> I don't know if this is a bug, but I would say that in principle it's
>>> the expected result. Single quotes are understood here as inner quotes
>>> or second-level quotation marks, therefore they are only activated
>>> nested in text with first level quotes: " ... '...' ... "
>>>
>>> lorem "ipsum 'dolor sit' amet"
>>>
>>> For LaTeX output, however, the csquotes package is a more powerful
>>> option to control the correct quotation marks for each language. For
>>> example:
>>>
>>> #+LaTeX_Header: \usepackage[german,english]{babel}
>>> #+LaTeX_Header: \usepackage[babel=true,autostyle=true,german=quotes]{csquotes}
>>> #+LaTeX_Header: \MakeOuterQuote{"}
>>> #+LaTeX_Header: \MakeInnerQuote{´}
>>>
>>> #+LaTeX: \selectlanguage{german}\EnableQuotes
>>> It's a ´test´. "Please".
>>>
>>> lorem "ipsum ´dolor´ sit" amet
>>>
>>> Best regards,
>>>
>>> Juan Manuel 
>>>
>>> Andreas Gösele writes:
>>>
>>>> Hi,
>>>>
>>>> even using "smart quotes", single quotes are not correctly exported into
>>>> html, odt or latex.
>>>>
>>>> I have as document:
>>>>
>>>> | #+LANGUAGE: de
>>>> | #+OPTIONS: ':t
>>>> | #+OPTIONS: toc:nil
>>>> | It's a 'test'. "Please".
>>>>
>>>> If I export it to html I get:
>>>>
>>>> | It&rsquo;s a &rsquo;test&rsquo;. &bdquo;Please&ldquo;.
>>>>
>>>> I should get:
>>>>
>>>> | It&rsquo;s a &sbquo;test&lsquo;. &bdquo;Please&ldquo;.
>>>>
>>>> If I export to latex I get:
>>>>
>>>> | It's a 'test'. "`Please"'.
>>>>
>>>> I should get:
>>>>
>>>> | It's a \glq{}test\grq{}. "`Please"'.
>>>>
>>>> If I export to odt I get:
>>>>
>>>> | It’s a ’test’. „Please“.
>>>>
>>>> I should get:
>>>>
>>>> | It’s a ‚test‘. „Please“.
>>>>
>>>> (The odt example outputs use utf8, I hope it gets transmitted.)
>>>>
>>>> So in all three cases apostrophes and double quotes are correctly
>>>> exported, but not single quotes. Similar problem if I use "#+LANGUAGE:
>>>> en".
>>>>
>>>> I have org-mode 9.3 with emacs 27.1.
>>>>
>>>> What could I do to get single quotes to be exported correctly?
>>>>
>>>> Thanks a lot!
>>>>
>>>> Andreas
>>>>


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 20:27       ` Andreas Gösele
@ 2021-05-28 20:37         ` Juan Manuel Macías
  2021-05-29  2:42           ` Andreas Gösele
  0 siblings, 1 reply; 14+ messages in thread
From: Juan Manuel Macías @ 2021-05-28 20:37 UTC (permalink / raw)
  To: Andreas Gösele; +Cc: orgmode

Hi Andreas,

Andreas Gösele writes:

> I tried it, but it doesn't work. It leaves the simple quotes
> untouched. Did you test it and did it work then?

I forgot to tell you (sorry!) that you should set the variable
`org-export-allow-bind-keywords' as non-nil:

(setq org-export-allow-bind-keywords t)

If you are going to use that filter in many documents, you can better add to your
~ /.emacs:

(add-to-list 'org-export-filter-final-output-functions 'single-quote-filter)

Best regards,

Juan Manuel 


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 19:48     ` Nicolas Goaziou
  2021-05-28 20:19       ` Juan Manuel Macías
@ 2021-05-28 21:06       ` Andreas Gösele
  1 sibling, 0 replies; 14+ messages in thread
From: Andreas Gösele @ 2021-05-28 21:06 UTC (permalink / raw)
  To: Andreas Gösele; +Cc: orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> "Andreas Gösele" <agoesele@sju.edu> writes:
>
>> So I'm wondering whether there is any way to make org export to
>> recognize single quotes also outside from double quote. It should be
>> possible as inner quotes is not the only use of simple quotes.
>
> Genuine question: what language uses two different styles of outer
> (level 1) quotes? And in what context?

Some publishers in Germany want you to use single quotes for quotes in
titles in the bibliography (even if the titles themselves are not inside
of quotes) or for terms.


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 17:55     ` Albert Krewinkel
@ 2021-05-28 21:39       ` Andreas Gösele
  2021-05-29 21:35         ` Andreas Gösele
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Gösele @ 2021-05-28 21:39 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Albert Krewinkel

Albert Krewinkel <albert+org-mode@zeitkraut.de> writes:

> Andreas Gösele <agoesele@sju.edu> writes:
>
>> [...] I tried to convert the LaTeX document with pandoc, tex4h and
>> latex2html to odt and html but none of them produces the correct
>> output.
>>
>> So I'm wondering whether there is any way to make org export to
>> recognize single quotes also outside from double quote. It should be
>> possible as inner quotes is not the only use of simple quotes.
>
> I apologize for the non-Emacs solution, but you can use pandoc in
> combination with the following Lua filter to get the desired result:
> https://github.com/pandoc/lua-filters/tree/master/pandoc-quotes.lua
> For LaTeX output, you can also pass -Vcsquotes as a parameter to force
> pandoc to make use of the csquotes package. Both should give you the
> desired results.

Thanks for the suggestion. I would be happy to use pandoc.

I tried it and it works well for quotes (double and single). But the
apostrophe only is correctly treated if I convert to LaTeX/PDF. (That's
because LaTeX transforms the "typewriter apostrophe" into the correct
typographic apostrophe.)

From:

 #+LANGUAGE: de
 #+OPTIONS: ':t
 #+OPTIONS: toc:nil
 It's a 'test'.

I get for html/odt:

 It's a ‚test‘.

But I should get:

 It’s a ‚test‘.

Directly using the org export I get:

 It’s a ’test’.

So with pandoc and the Lua filter the single quotes are correct, with
the direct export from org the apostrophe is correct.

Is there a way with pandoc to get correct quotes and apostrophes?

Thanks again!

Andreas


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 20:37         ` Juan Manuel Macías
@ 2021-05-29  2:42           ` Andreas Gösele
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Gösele @ 2021-05-29  2:42 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Andreas Gösele writes:
>
>> I tried it, but it doesn't work. It leaves the simple quotes
>> untouched. Did you test it and did it work then?
>
> I forgot to tell you (sorry!) that you should set the variable
> `org-export-allow-bind-keywords' as non-nil:
>
> (setq org-export-allow-bind-keywords t)

With this the filter works. Thanks a lot.

Andreas


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

* Re: Smart quotes not working correctly with single quotes
  2021-05-28 21:39       ` Andreas Gösele
@ 2021-05-29 21:35         ` Andreas Gösele
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Gösele @ 2021-05-29 21:35 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

thanks to Albert for pointing me to pandoc-quotes.lua.

It doesn't take care of apostrophes so I wrote my own very simple pandoc
lua filter:

 text = require 'text'
 function Str (s)
   s.text = pandoc.pipe("sed", {"-e","s/'/’/"}, s.text)
   return s
 end

Together with pandoc-quotes.lua and "-M lang=de" this gives the desired
result for odt and html.

For latex there was no problem with the apostrophes, but for some reason
(I don't understand) pandoc-quotes.lua with lang=de translates closing
quotes into "``" and "`" instead of "“" and "‘". (The opening quotes are
correct and in pandoc-quotes.lua the "de" entry correctly has "“" and
"‘".) This can lead to something like "```" if inner quotes are
immediately followed by outer quotes which LaTeX translates to "“‘"
instead of "‘“".

To solve this I created a meta file with:

---
quot-marks:
    - „
    - ​“
    - ‚
    - ‘
...

(The important thing being that there is a unicode "ZERO WIDTH SPACE"
(U+200B) in front of the second entry.)

I also put \DeclareUnicodeCharacter{200B}{{\hskip 0pt}} into
default.latex.

Using the meta-file with pandoc-quotes.lua and "-V lang=de" leads to
correctly nested quotes also for latex.

Thanks again to everybody!

Andreas

Andreas Gösele <agoesele@sju.edu> writes:

> Albert Krewinkel <albert+org-mode@zeitkraut.de> writes:
>
>> Andreas Gösele <agoesele@sju.edu> writes:
>>
>>> [...] I tried to convert the LaTeX document with pandoc, tex4h and
>>> latex2html to odt and html but none of them produces the correct
>>> output.
>>>
>>> So I'm wondering whether there is any way to make org export to
>>> recognize single quotes also outside from double quote. It should be
>>> possible as inner quotes is not the only use of simple quotes.
>>
>> I apologize for the non-Emacs solution, but you can use pandoc in
>> combination with the following Lua filter to get the desired result:
>> https://github.com/pandoc/lua-filters/tree/master/pandoc-quotes.lua
>> For LaTeX output, you can also pass -Vcsquotes as a parameter to force
>> pandoc to make use of the csquotes package. Both should give you the
>> desired results.
>
> Thanks for the suggestion. I would be happy to use pandoc.
>
> I tried it and it works well for quotes (double and single). But the
> apostrophe only is correctly treated if I convert to LaTeX/PDF. (That's
> because LaTeX transforms the "typewriter apostrophe" into the correct
> typographic apostrophe.)
>
> From:
>
>  #+LANGUAGE: de
>  #+OPTIONS: ':t
>
>  #+OPTIONS: toc:nil
>  It's a 'test'.
>
> I get for html/odt:
>
>  It's a ‚test‘.
>
> But I should get:
>
>  It’s a ‚test‘.
>
> Directly using the org export I get:
>
>  It’s a ’test’.
>
> So with pandoc and the Lua filter the single quotes are correct, with
> the direct export from org the apostrophe is correct.
>
> Is there a way with pandoc to get correct quotes and apostrophes?
>
> Thanks again!
>
> Andreas


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

end of thread, other threads:[~2021-05-29 21:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-28  2:54 Smart quotes not working correctly with single quotes Andreas Gösele
2021-05-28 10:10 ` Juan Manuel Macías
2021-05-28 15:42   ` Andreas Gösele
2021-05-28 17:02     ` Juan Manuel Macías
2021-05-28 20:27       ` Andreas Gösele
2021-05-28 20:37         ` Juan Manuel Macías
2021-05-29  2:42           ` Andreas Gösele
2021-05-28 17:20     ` Nicolas Goaziou
2021-05-28 17:55     ` Albert Krewinkel
2021-05-28 21:39       ` Andreas Gösele
2021-05-29 21:35         ` Andreas Gösele
2021-05-28 19:48     ` Nicolas Goaziou
2021-05-28 20:19       ` Juan Manuel Macías
2021-05-28 21:06       ` Andreas Gösele

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.