Ask Your Question
2

Change width of rich text cells in notebook

asked 2015-10-21 03:46:45 -0500

toster gravatar image

With the default settings, cells in the notebook take the whole width of the window. This is annoying for rich text cells with long paragraphs, as they get very hard to read. Also if you are using LaTeX math mode, the equations will be centered on the window, which looks bad if you only have rather short lines of text surrounding them.

I would like to know if there is a way to restrict the width of the rich text cells, such that lines of text get broken earlier and readability is improved. The settings contain an option for number of word wrap columns, but it seems to have no effect whatsoever on my worksheets.

edit retag flag offensive close merge delete

Comments

I'm not really sure it makes much sense to have a feature to reduce the width of a text cell unless we also have a way of making use of the now-unused space, i.e., an ability to place cells side by side. In the present situation you can make it more readable by reducing the window width, at no penalty.

If you're rendering the worksheet on a fixed-width medium, the appropriate solution would be to adjust the font size. The next step would be multi-column layout.

nbruin gravatar imagenbruin ( 2015-10-21 12:41:07 -0500 )edit

Which notebook are you using? The Sage Notebook on your computer (with .sws Sage worsheets)? The Jupyter notebook (with .ipynb worksheets)? Or are you working in SageMathCloud's (with .sagews Sage worksheets)?

slelievre gravatar imageslelievre ( 2015-10-22 00:17:13 -0500 )edit

@slelievre: I'm using the notebook on my local computer (.sws)

@nbruin: I disagree. Plenty of websites have a fixed-width layout with lots of whitespace on both sides for good reason: It improves readability considerably. This very website is a good example actually. It would be nice if we could somehow use the new whitespace, but it's not mandatory. Adjusting the window width is not an option if I am using the notebook as one of many tabs in my browser window. I have been using it in a separate window to fix the issue, but it's not an ideal solution.

toster gravatar imagetoster ( 2015-10-22 01:53:38 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-10-22 00:29:39 -0500

updated 2015-10-22 00:31:04 -0500

Here is one way to achieve your goal in the (old) Sage Notebook.

While editing a text cell, click on the "HTML" button of the formatting bar (one of the last icons in that bar). This will open a pop-up window called "HTML Editor", and containing the HTML source for your text.

For instance, it might read:

<p>With the default settings, cells in the notebook take the whole width of the window.
This is annoying for rich text cells with long paragraphs, as they get very hard to read.
Also if you are using LaTeX math mode, the equations will be centered on the window,
which looks bad if you only have rather short lines of text surrounding them.</p>
<p>I would like to know if there is a way to restrict the width of the rich text cells,
such that lines of text get broken earlier and readability is improved. The settings
contain an option for number of word wrap columns, but it seems to have no effect
whatsoever on my worksheets.</p>

Now just wrap everything in a table of your chosen width:

<table style="width: 600px;">
<tbody>
<tr>
<td>
<p>With the default settings, cells in the notebook take the whole width of the window.
This is annoying for rich text cells with long paragraphs, as they get very hard to read.
Also if you are using LaTeX math mode, the equations will be centered on the window,
which looks bad if you only have rather short lines of text surrounding them.</p>
<p>I would like to know if there is a way to restrict the width of the rich text cells,
such that lines of text get broken earlier and readability is improved. The settings
contain an option for number of word wrap columns, but it seems to have no effect
whatsoever on my worksheets.</p>
</td>
</tr>
</tbody>
</table>

I understand doing this globally would be preferrable, but at least this works if you're ready to perform this action for each cell.

edit flag offensive delete link more

Comments

That might be a workaround, if a bit tedious. Thanks!

toster gravatar imagetoster ( 2015-10-22 01:48:44 -0500 )edit

Given the use, that should probably be a max-width. If your window isn't wide enough for the specified width, you'd probably want the text to wrap with a smaller width.

Also, if the purpose is to wrap at an approximate number of characters, it might be better to specify the width in a unit that is relative to that, i.e., "ch" or "em" or something like that, rather than "px". That might mean that you have to have an appropriate font in effect outside the table already, though.

nbruin gravatar imagenbruin ( 2015-10-22 16:10:59 -0500 )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

Stats

Asked: 2015-10-21 03:46:45 -0500

Seen: 334 times

Last updated: Oct 22 '15