How do I mark code blocks, and how do I adjust syntax highlighting? Can I emphasize pieces of my code block? And how do code blocks in lists and blockquotes work?
|
The simplest way is to indent your code block by 4 spaces: To get the output
just type
(The first empty line is essential, the last one is recommended.) If you have more than one line, then it's simpler to highlight the code block and hit Ctrl+K (or click the "code" button, with "{}" on it). This auto-indents the highlighted code by 4 spaces (and also adds the empty lines in the beginning and in the end). See below for code blocks in lists and blockquotes. Syntax highlightingBy default, your code gets some LaTeX syntax highlighting. (This doesn't work on meta.tex.sx, so unfortunately you can't see it here.) If you don't want this syntax highlighting, you can use a special HTML comment to specify the language. For no highlighting, use
(You wouldn't want Emphasizing pieces of the codeIf you want to highlight parts of your code using bold or slanted text, or if you want to
gives
\documentclass[paper=a5,pagesize]{scrbook}
\usepackage[draft]{graphicx}
(Note that the If you want syntax highlighting and additional emphasis in bold or slanted, use
Note that there are no line breaks after Code blocks in listsIf your code appears inside a list, you must indent a further four spaces for every level of nesting. An example:
gives
So you need 8 spaces in the first level, 12 spaces in the second level and so on. Code blocks after listsIf you want a code block immediately after a list, you need to put an HTML comment between the list and the code block:
gives
Code blocks in blockquotesA blockquote is started with
gives
|
|||||||||||||
|