From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: "Andreas Gösele" <agoesele@sju.edu>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: Smart quotes not working correctly with single quotes
Date: Fri, 28 May 2021 17:02:40 +0000 [thread overview]
Message-ID: <87h7imkczz.fsf@posteo.net> (raw)
In-Reply-To: <871r9qrhj3.fsf@sju.edu> ("Andreas Gösele"'s message of "Fri, 28 May 2021 11:42:56 -0400")
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’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
>>>
next prev parent reply other threads:[~2021-05-28 17:04 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 [this message]
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
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=87h7imkczz.fsf@posteo.net \
--to=maciaschain@posteo.net \
--cc=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).