Ask Your Question
0

Latex text in notebook and return lines

asked 2019-07-18 10:35:03 +0100

ortollj gravatar image

Hi

is there a way to display a text in notebook with return lines out of this heavy way ?:

show(LatexExpr(r" \
\text{ Late at night, guards on the battlements of Denmark's Elsinore castle}\\ \
\text{are met by Horatio, Prince Hamlet's friend from school.}\\ \
\text{The guards describe a ghost they have seen that resembles Hamlet's father,}\\ \
\text{the recently-deceased king. At that moment, the Ghost reappears,}\\ \
\text{and the guards and Horatio decide to tell Hamlet.}\
"))
edit retag flag offensive close merge delete

Comments

I can't parse your request :

with return lines out of this heavy way

What do you bloody mean ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2019-07-18 17:56:53 +0100 )edit

Juanjo guessed what I meant. I meant: except this way with a somewhat heavy syntax.

ortollj gravatar imageortollj ( 2019-07-19 07:59:22 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-07-18 23:37:00 +0100

Juanjo gravatar image

In the notebook, you can display text using HTML instead of LaTeX:

text = """
Late at night, guards on the battlements of Denmark's Elsinore castle<br>
are met by Horatio, Prince <strong>Hamlet</strong>'s friend from school.<br>
The guards describe a ghost they have seen that resembles <strong>Hamlet</strong>'s father,<br>
the recently-deceased king. At that moment, the Ghost reappears,<br>
and the guards and Horatio decide to tell <strong>Hamlet</strong>.
"""
show(html(text))

This allows a better formatting using HTML and CSS. Note, for example, in the above text, that each instance of "Hamlet" is displayed in boldface.

edit flag offensive delete link more

Comments

Thanks again Juanjo, that is what I wanted.

ortollj gravatar imageortollj ( 2019-07-19 07:57:39 +0100 )edit

put your text between:

text = """

your text

"""

show(html(text))

position the mouse just after the largest column of your text, and on the first line of your text. then press the "Alt" key and move the mouse down to the last line and type <br>

ortollj gravatar imageortollj ( 2019-07-27 13:47:53 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-07-18 10:35:03 +0100

Seen: 473 times

Last updated: Jul 18 '19