Sometimes you want to make a chunk of text stand out from the main text. For example, in a text book, you may want to have a special format for definitions, theorems or a historical note. Decorations are declared the same way that disclosables are declared, by sandwiching them between two headings. Smartdown currently offers the following decoration tags for special formatting:
--outlinebox
- a white background with black text and a gray rounded outline--colorbox
- a dark bluegray background with white text and rounded corners--partialborder
- a light purple background with black text and double top and bottom outline--aliceblue
- a light blue background with black text and a light gray rounded outline
The following decoration puts an outline box around the content
# --outlinebox cartesian_product
**Definition 1.0**
For sets $A$ and $B$ the *Cartesian product* or *cross product*, of $A$ and $B$ is denoted by $A \times B$ and equals
$$\{(a,b) \, | \, a \in A, \, b \in B \}$$
An element $(a,b)$ of $A \times B$ is called an *ordered pair*.
# --outlinebox
The opening line of the decoration is a header tag #
followed by the type of decoration --outlinebox
and a name for the block of content cartesian_product
. The closing of the decoration is again a header tag #
followed by the type of decoration.
This is displayed as:
Definition 1.0
For sets
An element
Another decoration places content in a dark background box using the tag --colorbox
. The proof is from Michael Sipser's Introduction to the Theory of Computation.
Theorem 1.1
In any graph
PROOF: Every edge in
Here we use the --partialborder
decoration for an example.
Example 1.2
If
The old formatting for disclosables is now a decoration. It uses the --aliceblue
tag and looks like this:
Example 1.2
If
You can nest decorations of different types.
Definition 1.0
For sets
An element
Example 1.2
If
Decorations can be used inside any disclosable.
Here is an example of a math problem that uses decorations and disclosables. If you enter the correct answer the solution is revealed or you can open the solution yourself if you're frustrated and just want the answer. The solution is in a disclosable that is wrapped in an --outlinebox
decoration.
Problem 1.3
For what real values of
Your Answer
smartdown.setVariable('answer', '');
this.dependOn = ['answer'];
this.depend = function() {
if (env.answer === '64') {
smartdown.showDisclosure('sol1', '', '');
}
};
Show Solution
Solution:
We know that
More cool stuff with decorations and disclosables is coming soon!
Back to Home