LatexExpr

30 views
Skip to first unread message

cyrille piatecki

unread,
Nov 29, 2021, 12:05:58 PM11/29/21
to sage-support
I often use LatexExpr(r'\text{blabla} x_i =') encapsulated in show(). It's very easy to use
but not if I need  one cote as in "it's". Is there a way to escape the cote ?

Thanks

slelievre

unread,
Nov 29, 2021, 2:07:21 PM11/29/21
to sage-support
2021-11-29 18:05:58 UTC+1, Cyrille Piatecki:

>
> I often use LatexExpr(r'\text{blabla} x_i =') encapsulated
> in show(). It's very easy to use but not if I need single quotes
> as in "it's". Is there a way to escape the quotes?

LatexExpr(r"\text{there's a way} x_i =")

John H Palmieri

unread,
Nov 29, 2021, 5:47:56 PM11/29/21
to sage-support
Or if you need single and double quotes, delimit the string with """ or ''' (three double-quotes or three single-quotes):

r"""here is "some" 'text' """

cyrille....@univ-orleans.fr

unread,
Nov 30, 2021, 3:19:24 AM11/30/21
to sage-s...@googlegroups.com
Thanks

----- Mail d’origine -----
De: John H Palmieri <jhpalm...@gmail.com>
À: sage-support <sage-s...@googlegroups.com>
Envoyé: Mon, 29 Nov 2021 23:47:56 +0100 (CET)
Objet: [sage-support] Re: LatexExpr
--

You received this message because you are subscribed to the Google Groups "sage-support" group.

To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.



cyrille....@univ-orleans.fr

unread,
Nov 30, 2021, 12:46:28 PM11/30/21
to sage-s...@googlegroups.com
Thanks John. But LatexExpr(r"\text{there"'"s a way} x_i =") generate a mistake.

----- Mail d’origine -----
De: John H Palmieri <jhpalm...@gmail.com>
À: sage-support <sage-s...@googlegroups.com>
Envoyé: Mon, 29 Nov 2021 23:47:56 +0100 (CET)
Objet: [sage-support] Re: LatexExpr

Samuel Lelièvre

unread,
Nov 30, 2021, 12:59:25 PM11/30/21
to Sage-support
2021-11-30 17:46 UTC, Cyrille Piatecki:
>
> Thanks John. But LatexExpr(r"\text{there"'"s a way} x_i =")
> generates a mistake.

John's suggestion was that a string that contains
both single-quote and double-quote characters
can be enclosed by tripled delimiters, using
either '''...''' or """...""".

More examples:

LatexExpr(r"\text{there's a way } x_i =")
LatexExpr(r'''\text{there's a way } y' + y" = 0''')
LatexExpr(r"""\text{there's a way } y' + y" = 0""")

See more on strings, also known as "text sequences",
in the Python documentation for built-in types:

https://docs.python.org/3/library/stdtypes.html#textseq

cyrille....@univ-orleans.fr

unread,
Nov 30, 2021, 1:17:11 PM11/30/21
to sage-s...@googlegroups.com
Thanks obviously I have not understud the suggestion of John.
----- Mail d’origine -----
De: Samuel Lelièvre <samuel....@gmail.com>
À: Sage-support <sage-s...@googlegroups.com>
Envoyé: Tue, 30 Nov 2021 18:59:04 +0100 (CET)
Objet: Re: [sage-support] Re: LatexExpr
--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CAEcArF2ZmBE66XSAudqt0MOeU82yvt7ctgtoksoFyFX2JuGSZw%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages