You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The distinction between single and double smart quotes makes no sense #1194
I don't really know if this is a suggestion or a bug, but the current way Typst treats quotes is weird.
In text mode, there are two ways to quote something: using single quotes ('single quotes'), or using double quotes ("double quotes"). In English, the former gets rendered as
while the latter is rendered as
This makes sense because both single and double quotes are used in English. Typically, double quotes are used first, and single quotes are used as “second level” quotes.
But this is arbitrary, and it does not make sense for some languages.
For example, in French, the usage is to use guillemets (« guillemets ») as top-level quotes and double quotes (“double quotes”) when nested. Single guillemets (‹ single guillemets ›) are never used in french.
So I guess my suggestion is to get rid of the single/double quotes distinction and instead have a list of quote kind per level for every language—which should also be customizable using the text function—and let the compiler infer the quote level (which I think it already somewhat does) to use the right kind of quotes.
Use Case
As explained above, the main use case is being able to properly quote stuff in languages other than English. The distinction between single and double quotes is used to differentiate between different levels, so let's make it work that way.
With this proposal, languages that have quotes for more than two levels can be supported.
Reacted by user202729, Ray Offiah, Jakub Kaczor and WO Kah Jen
This makes sense because both single and double quotes are used in English. Typically, double quotes are used first, and single quotes are used as “second level” quotes.
There's a perhaps bit more than meets the eye... British English (or Welsh, and a few other language) use single quotes as primary quotation marks and double quotes as secondary marks, but US English normally uses double quotes as primary marks and single quotes as secondary marks.
The main issue, I believe, is therefore to propose a "decent" interpretation of non-typographical "straight" quotes to be replaced by appropriate typographic primary and secondary quotation marks in a given language, depending both on the expectation of the user and the typographic rules applying to that language.
For reference, you might possibly be interested to look at how I addressed it in smartquotes.sile - It's a package for the SILE typesetter (more precisely, a low-level package notably used for interpreting straight quotes in Markdown/Djot with "smart typography"), but the Lua code should be understandable and it mainly boils down to a big table of (primary, secondary) marks for a bunch of languages, derived from several sources.
With this proposal, languages that have quotes for more than two levels can be supported.
Note however that there are not many languages that have tertiary quotation marks or really use them nowadays; and the rules for using them are not always straightforward (I renounced addressing it in my SILE package -- It doesn't mean is not doable, but it might get trickier if one really wants them, unless it can be checked with native users knowledgeable about the topic).
(As a side note, regarding the above-mentioned current logic in quotes.rs, the use of a \u{00A0} space in French quotes is not really respecting the true typography, but that's a different topic.)
changed the title [-]The distinction between single and double quotes makes no sense[/-][+]The distinction between single and double smart quotes makes no sense[/+]on May 24, 2023
I wanted to add that because there are differences in American and British English, the csquotes (and babel) package in LaTeX does separate languages as american and british (see page 3).
This is why I was "shocked" by the double parameter in the smartquote function. It should go so, there is only one parameter left — enabled.
If it is not something desirable (one parameter function), then things like which quote at which level must be applied, but this implies that enabled must be equal to false (maybe set it to auto | boolean = auto).
I think this is an unsolvable issue in the sense that QWERTY keyboards have two kinds of quotes, and there is no perfect way to map them to quotes used in different languages.
I would say that smartquote.quotes is the only way to solve this problem (by giving the control to the user).
Activity
Omikhleia commentedon May 24, 2023
Greetings,
Unless mistaken, I think this issue refers to the handling of "smart" quotes, right? That is, as currently done here:
typst/library/src/text/quotes.rs
Line 124 in 6af94be
There's a perhaps bit more than meets the eye... British English (or Welsh, and a few other language) use single quotes as primary quotation marks and double quotes as secondary marks, but US English normally uses double quotes as primary marks and single quotes as secondary marks.
The main issue, I believe, is therefore to propose a "decent" interpretation of non-typographical "straight" quotes to be replaced by appropriate typographic primary and secondary quotation marks in a given language, depending both on the expectation of the user and the typographic rules applying to that language.
For reference, you might possibly be interested to look at how I addressed it in smartquotes.sile - It's a package for the SILE typesetter (more precisely, a low-level package notably used for interpreting straight quotes in Markdown/Djot with "smart typography"), but the Lua code should be understandable and it mainly boils down to a big table of (primary, secondary) marks for a bunch of languages, derived from several sources.
Note however that there are not many languages that have tertiary quotation marks or really use them nowadays; and the rules for using them are not always straightforward (I renounced addressing it in my SILE package -- It doesn't mean is not doable, but it might get trickier if one really wants them, unless it can be checked with native users knowledgeable about the topic).
(As a side note, regarding the above-mentioned current logic in
quotes.rs, the use of a\u{00A0}space in French quotes is not really respecting the true typography, but that's a different topic.)[-]The distinction between single and double quotes makes no sense[/-][+]The distinction between single and double smart quotes makes no sense[/+]Andrew15-5 commentedon Jun 16, 2023
I wanted to add that because there are differences in American and British English, the
csquotes(andbabel) package in LaTeX does separate languages asamericanandbritish(see page 3).This is why I was "shocked" by the
doubleparameter in thesmartquotefunction. It should go so, there is only one parameter left —enabled.If it is not something desirable (one parameter function), then things like which quote at which level must be applied, but this implies that
enabledmust be equal tofalse(maybe set it toauto | boolean = auto).laurmaedje commentedon Apr 13, 2024
With consideration of @Omikhleia's comment and the
smartquote.quotesproperty available, is there still something left to change here?MDLC01 commentedon Apr 14, 2024
I think this is an unsolvable issue in the sense that QWERTY keyboards have two kinds of quotes, and there is no perfect way to map them to quotes used in different languages.
I would say that
smartquote.quotesis the only way to solve this problem (by giving the control to the user).