0

I'm used to typing typographically correct English quotation marks as follows:

``text goes here"

In usual LaTeX documents this will work, no questions asked. When I use Markdown in Jupyter notebooks, however, this does not always seem to work. Using PyCharm 2023.1.3 (Professional Edition) the quotation marks are displayed correctly: Quotation Marks in PyCharm

When I take a look at the exact same Notebook file in e.g. Github, the same text is displayed as follows:

Quotation Marks in Github

Both seem to use LaTeX in their Markdown texts. Yet somehow they are still displayed differently. I wonder where the technical background for these differences lies? Also, is there an alternative way of typing these quotation marks?

MWE for the output above:

> [...]
>
> Consider the case where a word sequence $\alpha$ is a sub-sequence of $\beta$ (for example $\alpha = \textrm{``in spite"}, \beta = \textrm{``in spite of"}$. Then, we have:
> $f(\alpha) \geq f(\beta)$
> Further, the word sequence $\alpha, f(\beta)$ times out of $f(\alpha)$ times, will be identified as $\beta$. Thus, the actual reduced cost for $\alpha$ is defined as:
> $K(\alpha) = \left(\left\vert \alpha \right\vert - 1\right) \times \left(f(\alpha) - f(\beta)\right)$

Edit: As @Rmano suggested, I changed the closing quotes to '' instead of using ". As expected, this did not change the output for PyCharm. It did, in fact, change the appearance for Github, but for the worse, displaying the closing quotation marks as two single quotation marks: Output in Github with wrong quotes This does not seem to be a proper solution.

7
  • 5
    ``text goes here" is incorrect tex markup, even though it may work in some fonts, it should be ``text goes here'' that is two ' not one " Commented Jul 6, 2023 at 13:50
  • @DavidCarlisle I added my MWE just now, showing that my quotation marks are, in fact, part of the LaTeX code within my markdown text. It should be correct then, shouldn't it?
    – TiMauzi
    Commented Jul 6, 2023 at 13:53
  • 2
    No, the correct way in LaTeX is always to use the two single straight quotes to close. Some font have a " rendering that is the same as the effect of '', but you never know. If that thing is automatically generated, is still wrong ;-).
    – Rmano
    Commented Jul 6, 2023 at 14:00
  • 1
    using latex in markdown is tricky it's not surprising ` is hard as it is a special character for makrdown as on this site making verbatim code xxx Commented Jul 6, 2023 at 14:10
  • 1
    @Rmano This didn't solve anything, it made it worse... I edited my question accordingly.
    – TiMauzi
    Commented Jul 6, 2023 at 14:10

1 Answer 1

3

I wonder where the technical background for these differences lies.

In TeX, `` and '' are ligatures that are typeset as " and " in most fonts. However, this is a convention specific to TeX that does not extend to most other systems. Furthermore, in Jupyter notebooks, writing `` will clash with the Markdown syntax for code spans. Specifically, writing `` twice in a paragraph will interpret the first `` as the beginning of a code span and the second `` as the end of a code span.

Both seem to use LaTeX in their Markdown texts. Yet somehow, they are still displayed differently.

Most Jupyter notebook viewers will only expect (La)TeX inside math. They will usually not expect (La)TeX code and ligatures outside math. Some systems, such as PyCharm, will go the extra mile, but in my experience, that's an exception rather than the rule.

Also, is there an alternative way of typing these quotation marks?

You should type the Unicode characters " and ". Most operating systems provide keyboard shortcuts that you can use. If you only want to prevent clashes with the Markdown syntax, you can type \`\` and ''. This will prevent the interpretation of `` as the beginning/end of a code span, but GitHub will still typeset `` as `` and '' as '', which you may find less appealing than " and ".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .