How do I stop bookdown reordering punctuation?

Viewed 75

I have forked bookdown-minimal here to produce the minimal reproducible example of my issue.

I want the following sentence to be rendered as is. That is, I want the full stop (period) to remain outside the quotes.

This is the on-line version of "A Book".

I have made a minimal bookdown example here

The line bibliography: [book.bib] causes the sentence to be rendered using "Build book" as

This is the on-line version of "A Book."

I know this is a convention of American English, but other languages (and other variants of English) don't do this and I don't want to do it in the real sentences I have (it seems that the issue occurs with other items of punctuation, such as ! and ?, that even American English puts in the correct place).

What is driving this behaviour? (Note that I am not actually including references in my minimal example.) Is there any easy way to stop it?

2 Answers

The system respects the lang metadata variable. So if you are writing British English, then add this to your YAML metadata:

lang: en-GB

The result should be

This is the on-line version of “A Book”.

whereas

lang: en-US

gives

This is the on-line version of “A Book.”


If all else fails, you can resort to adding a Lua filter which adds an invisible character like a zero-width joiner. This will prevent the reordering from happening as well.

function Quoted (quote)
  return {quote, pandoc.Str '\u{200d}'}
end

Note that you can take advantage of this trick on a per-case basis by using the ‍ entity in your Markdown input:

This is the on-line version of "A Book"‍.

This should do the trick:

This is the on-line version of "\text{A Book}"\text{.}
Related