# Change width of rich text cells in notebook

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 close merge delete

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.

( 2015-10-21 12:41:07 -0600 )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)?

( 2015-10-22 00:17:13 -0600 )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.

( 2015-10-22 01:53:38 -0600 )edit

Sort by » oldest newest most voted

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.

<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.

more

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

( 2015-10-22 01:48:44 -0600 )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.

( 2015-10-22 16:10:59 -0600 )edit