3
$\begingroup$

I would like to format a cell as a block quote. Similar to here on stackoverflow:

This is a blockquote.

I think there is no such default style in Mathematica version 11.2.

Does anyone have or know how to create a block quote style which will augment the default notebook style?

$\endgroup$
  • $\begingroup$ How exactly should it behave/look like? $\endgroup$ – Kuba Apr 26 '18 at 16:07
  • $\begingroup$ I guess text should be indented and has a background color. I know everyone has a different expectation, but I was hoping that there is already something out there. Virtually all authoring tools offer a default style: LaTeX, Markdown, reStructuredText, Html, LibreOffice Writer, MS Word, .... $\endgroup$ – Hotschke Apr 26 '18 at 16:18
5
$\begingroup$

I thought this was a good idea, so I added a BlockQuote style to the custom stylesheet I normally use. That is, I added the cell

Cell[StyleData["BlockQuote"],
  CellMargins->{{90, 3.}, {4., 4.}},
  MenuSortingValue->1540]

You can do the same.

If you don't already have a custom stylesheet, do the following:

  1. Open any new notebook in the default style.
  2. Choose Edit Stylesheet... from the Format menu.
  3. Type BlockQuote into the input field at the top of the stylesheet template. Hit Return.
  4. Select the BlockQuote cell that appears and type Cmd+Shift+E
  5. Select the Cell expression and paste the above code over it.
  6. type Cmd+Shift+E
  7. I didn't want a background color so I didn't set one. You can set one at this point by selecting the BlockQuote cell and giving it a background color using the Format menu.
  8. Click on the Install Stylesheet... button at top-right of the stylesheet template and install the new stylesheet.

Update

This update addresses a further question asked by the OP in a comment below.

The easiest way, I think, is to open a new notebook, give it your custom stylesheet as its stylesheet, choose Edit Stylesheet... from the Format menu, make your edits and then reinstall the stylesheet.

The installation dialog will insist that you give the edited stylesheet a name different from its current name. For how to deal with that read the notes to this answer

$\endgroup$
  • $\begingroup$ Thanks for your answer. How can I edit the stylesheet after I have installed it? $\endgroup$ – Hotschke Apr 27 '18 at 12:20
  • $\begingroup$ @Hotschke. I have updated my answer to address the issue of editing. $\endgroup$ – m_goldberg Apr 27 '18 at 14:02
  • $\begingroup$ I see. Thanks also for the link. IMHO this is not really convenient. People at WR seem to have different workflows. $\endgroup$ – Hotschke Apr 27 '18 at 14:12
1
$\begingroup$

There are a few built-in styles that might be useful:

  • "CodeText", which is similar to normal text, except that it's gray instead of black, and leaves a bit more space between it and the cell above and a bit less below.

  • "SmallText", which is similar to normal text, except that the font is a bit smaller.

  • "ItemParagraph", which is similar to normal text, but indented a bit more. There are also "sub" variants of these that indent more and decrease the font size a bit.

If you don't use a lot of different styles, I fing the easiest way to use these is to use Format > Style > Other since it has a keyboard shortcut and remembers the last style used.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.