Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

04 Notebook Styling

0 (0 Likes / 0 Dislikes)
This section is about customizing the overall style of Wolfram Notebooks and the styles of the cells and the content within a notebook. Style here refers to the appearance and behavior of things in a notebook. For example, here is a typical notebook, which like all Wolfram Notebooks is made up of units called cells, which are identified by these brackets on the right side of the window. Cells have different styles. The first cell has a style called Title, the style of the second cell is Section and this notebook also contains two Text cells and two Input cells and two Output cells. Each cell style uses different colors and different fonts and font sizes. Text cells use different indentation than Section cells, and Input and Output cells have these labels with the input and output number. All of these things are part of the style of the cell. A notebook like this can be created by choosing New from the File menu to get a new notebook, and typing into the empty notebook. Input by default goes into an Input Cell and if I evaluate that input the result is displayed in an Output Cell. Subsequent inputs and outputs give additional Input and Output cells. The horizontal line after the last output is the Cell Insertion Bar. This is where a new cell will appear if I start typing. To put a cell somewhere else, I can click to position the Cell Insertion Bar anywhere between the existing cells. The available cell styles for this notebook are shown in the Style submenu of the Format menu, for example, to add a Title cell I can click to position the Cell Insertion Bar at the top of the notebook, choose title from the Style submenu and enter the title. To enter the Section Cell, I will choose Section from the Style submenu and enter the name of the section. Common cell styles also have keyboard shortcuts, which are listed in the Style submenu. For example, to add a Text cell I will here use the keyboard shortcut and then enter the contents of the cell. The style of a cell can also be changed after the cell is created. For example, to insert another Text cell I can position the Cell Insertion Bar where I want the new cell and enter the contents of the cell. Right now, this is an Input cell, since that is the default, but I can convert it to a Text cell by choosing Text from the Style submenu or by typing the keyboard shortcut, and the cell is converted to a Text cell. Actually if I just start typing ordinary text into an Input cell, like this, the system typically recognizes that whatever is being entered is not computer input and puts up this menu offering to treat the input in some other way. One of the choices on that menu is text, which converts the cell into a Text cell, so that is yet another way to get a Text cell. Almost everything in this display can be customized. For example, to emphasize some bit of text, I could select that text and change the style using items under the Format menu. For example, this sets the text color to red and the text to a somewhat larger size. You can also change the styles for entire cells. For example, to change the styles for the Section cell I can select the cell bracket and again use items from the Format menu to change the styles. For example, this sets the background of the cell to light orange and the text color to black. All of these changes work by controlling options in the underlying cell expressions. You can see the options settings explicitly by choosing Show Expression from the Cell menu, which displays the underlying cell expression. For example, with that Section cell selected I can choose Show Expression to see the cell expression, which shows the content of the cell and the argument that identifies this as a Section cell and the font color option to specify that the text should be shown in black and the background option to specify the light orange background. This particular RGB color expression is how colors are specified in notebooks. I can also type options into the cell directly. For example, here I will insert the TextAlignment option and specify Center as the value of the option. Then choose Show Expression from the Cell menu to reformat the cell and the display shows the effect of all of those options settings, including the effect of the TextAlignment option to center the text. There are actually many hundreds of options like this. The general tool for setting options is the Option Inspector, which is opened by choosing Option Inspector from the Format menu or by using the equivalent keyboard shortcut. For example, entering background into the search box in the Option Inspector brings up the entry for the Background option, which here shows the value of this option that was just entered using the Format menu. The icon with the X on the left side of the Option Inspector entry indicates that this option is set within the selection. Clicking that icon removes that option setting, which returns the background to the default value, which for this cell is a plain white background. You can also enter options settings using the Option Inspector. For example, there is an option called CellDingbat that can be used to add something called a cell dingbat, which is a kind of marker on the left side of the cell. Clicking this little arrow brings up a menu of choices for the cell dingbat. Here I will choose Filled Small Circle, which changes the value of the option in the Option Inspector and adds a filled small circle on the left side of the cell. In the upper left corner of the Option Inspector there is another important menu for choosing whether options should be shown for the thing that is selected or for the entire selected notebook, or if the Option Inspector should show Global Preferences. For example, choosing Selected Notebook causes the Option Inspector to show options for the entire notebook, not just for the selected cell. For example, if I now set the background option to some other color, that will set the background for the entire notebook and not just for the selected cell. For now I will click the X in the Option Inspector to set the background color back to the default. Rather than setting options for individual selections like this, probably the most common way of customizing a notebook is by choosing from predefined cell styles and predefined stylesheets. Every notebook has a stylesheet, the stylesheet for a notebook can be set by choosing a stylesheet from the Stylesheet submenu under the Format menu. This particular notebook uses a stylesheet called Default, which is the item that is checked in this menu. All of the options for the cells in this notebook are set up in that stylesheet. There are quite a few other stylesheets to choose from. For example, this switches the stylesheet for this notebook to JournalArticle. This is still the same notebook, but the display uses different fonts and different font sizes and the title is centered rather than aligned on the left and there are many other differences. Here is another stylesheet called Garnet from the PresenterTools submenu. PresenterTools styles are styles that can be used to show this notebook as a slideshow, which will be discussed in a later section. That's the end of the examples for this section. The next section is about editing stylesheets, which you can do to customize existing styles or create new cell styles or to design your own stylesheets. There are also hundreds of cell options and notebook options beyond the options that came up in this section. You can find more information about other options in the Wolfram Documentation in this tutorial on Options for Cells and in this tutorial on Options for Notebooks.

Video Details

Duration: 7 minutes and 8 seconds
Country:
Language: English
License: Dotsub - Standard License
Genre: None
Views: 1
Posted by: wolfram on Dec 9, 2019

04 Notebook Styling

Caption and Translate

    Sign In/Register for Dotsub above to caption this video.