emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Andreas Gösele" <agoesele@sju.edu>
To: emacs-orgmode@gnu.org
Subject: Re: Smart quotes not working correctly with single quotes
Date: Sat, 29 May 2021 17:35:23 -0400	[thread overview]
Message-ID: <87a6odp6jo.fsf@sju.edu> (raw)
In-Reply-To: <87lf7ypmh4.fsf@sju.edu> ("Andreas Gösele"'s message of "Fri, 28 May 2021 17:39:03 -0400")

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


  reply	other threads:[~2021-05-29 21:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-05-28 19:48     ` Nicolas Goaziou
2021-05-28 20:19       ` Juan Manuel Macías
2021-05-28 21:06       ` Andreas Gösele

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6odp6jo.fsf@sju.edu \
    --to=agoesele@sju.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).