Introduction to Markdown#
Writing physics in a notebook#
Markdown uses simple text markers to organize and format writing. In a Jupyter notebook, Markdown cells hold explanations, headings, links, and mathematical notation, while code cells hold executable Python. Google Colab calls Markdown cells text cells. Rendering a text cell displays the formatted version of what you wrote; it does not require compiling a separate document.
For this course, these tools let you present an argument that combines prose, equations, calculations, and figures. Write for a reader who needs to understand how you reached your result—including future-you, reviewing the material before an exam.
The Homework Assignments page defines the required submission format and explains how an introduction, method, results and discussion, and conclusion contribute to a solution. Use this guide as a reference for putting that writing into a notebook. You do not need to memorize every formatting command before beginning.
Editing and rendering text cells#
Open a text cell in editing mode to see its Markdown source. Edit the text, then finish editing to inspect the rendered result. In Colab, double-clicking a rendered text cell opens its editor; Shift+Enter renders the cell and moves to the next one. Code belongs in a code cell, where it can be executed.
The shaded source examples throughout this guide show what to type or copy. Their surrounding triple backticks mark a code block in this tutorial; do not copy those fences when you want the enclosed Markdown to render as ordinary homework text.
Tip
Work smart, not hard! Use the rocket ship launch menu on the relevant course chapter page to open its notebook in Google Colab. Open the cell containing the homework question and copy the question directly from its Markdown source into your own notebook. Preserve the equations and part labels, then apply the bold blockquote format below. You can also inspect an equation already presented in the course text and reuse its LaTeX structure in your own analysis. Do not spend time searching for how to typeset an equation when its source is already available. Adapt the notation to your problem and explain your own reasoning; see the portability guidance below for MyST commands to leave out.
Save your own notebook copy in Google Drive before working, and use Ctrl+S frequently (Command+S on a Mac). Check that the save has completed.
Headings and organization#
Begin a heading with one or more # characters followed by a space. The number of characters gives its level. For a homework submission, use one top-level heading for the assignment and a second-level heading for each problem:
# PHYS 321 — Chapter 02
## Problem 1
## Problem 2
Use ### for a subsection only when it improves navigation through a longer investigation. The four parts of the scientific argument can also appear as connected paragraphs without explicit headings. Follow the length and content guidance in the homework template.
Leave a blank line before and after headings. Keep heading levels consistent rather than choosing them simply to change font size.
Paragraphs and line breaks#
Separate paragraphs with a blank line. A single line break in the source usually remains part of the same rendered paragraph.
The observers assign different velocities to the particle. We need to determine whether they also measure different accelerations.
A Galilean transformation relates the two descriptions and provides a way to compare them.
For normal scientific writing, paragraph breaks are more useful than forced line breaks. If you need a line break within one paragraph, such as between lines of a short address, end the line with two spaces before pressing Enter, or use <br>.
Keep ordinary paragraphs left-aligned in the source. Do not use repeated spaces, tabs, or to create paragraph indents: leading indentation can make prose appear as code. Let the notebook handle line wrapping.
Emphasis and problem statements#
Use *italics* for italics, **bold** for bold, and ***both*** for combined emphasis. Use emphasis sparingly so that the important information remains easy to find. Conclusions do not require italics.
For homework, put the problem statement in bold inside a blockquote. Start each quoted line with > and a space:
> **Show that the form of Newton's second law is invariant under a Galilean transformation.**
This renders as:
Show that the form of Newton’s second law is invariant under a Galilean transformation.
For a multipart question, retain the original labels. Use a line containing only > to separate quoted paragraphs:
> **A photon has frequency $\nu$.**
>
> **(a) Express its energy in terms of $\nu$.**
>
> **(b) Determine how the energy changes if the frequency doubles.**
Leave a blank line after the blockquote, then begin your own explanation without >. Ordinary prose should not inherit the bold formatting of the question. Mathematical symbols inside a bold statement are still formatted by the math renderer and may not appear bold.
Blockquotes can be nested with >>, but that extra level is usually unnecessary for homework. Reserve the blockquote treatment for the problem statement or an actual quotation.
Lists#
Use a numbered list when order matters and a bulleted list for parallel items. Leave a blank line before and after a list.
1. Define the reference frames.
2. Transform the particle's acceleration.
3. Compare the equations of motion.
- State the assumptions.
- Identify the quantities being compared.
- Distinguish the frame velocity from the particle velocity.
- Interpret the result.
Indent a nested item under its parent, as shown above. A nested numbered list uses ordinary entries such as 1. and 2. at the appropriate indentation; typing 1.1 does not automatically create a numbered sublist.
Lists work well for assumptions or procedural summaries. Develop your physical argument in complete sentences and connected paragraphs rather than replacing the explanation with a list of equations or fragments.
Links and source credit#
Put descriptive link text in square brackets and the destination immediately afterward in parentheses:
[PHYS 321 course notes](https://saturnaxis.github.io/ModernPhysics/home.html)
A link helps readers reach a source, but explain what you used from that source. Credit externally obtained figures, data, or explanations where they appear. A literature review is not required for ordinary homework.
Use absolute web links for all links to other pages, including pages within this course. Copy the full published URL beginning with https://, rather than linking to a relative notebook or HTML filename. For example:
[Homework Assignments](https://saturnaxis.github.io/ModernPhysics/Preamble/HW_template.html)
This convention keeps links usable from the course website and a separate homework notebook and avoids relative-link warnings in the course book build.
Writing mathematics with LaTeX#
Notebook Markdown supports LaTeX-style mathematical notation. Put a short expression between single dollar signs to place it within a sentence:
A photon of frequency $\nu$ has energy $E=h\nu$, where $h$ is Planck's constant.
A photon of frequency \(\nu\) has energy \(E=h\nu\), where \(h\) is Planck’s constant.
Put a longer equation between pairs of dollar signs to display it on its own line. Leave blank lines around the display, and make the equation part of a grammatical sentence:
The Lorentz factor is
$$
\gamma = \frac{1}{\sqrt{1-v^2/c^2}},
$$
where $v$ is the relative speed and $c$ is the speed of light.
The Lorentz factor is
where \(v\) is the relative speed and \(c\) is the speed of light.
Match every opening math delimiter with its closing delimiter. Within math, use braces to group a numerator, denominator, exponent, or subscript containing more than one character. For example, x^{12} places both digits in the exponent, whereas x^12 does not.
Useful mathematical notation#
The following examples are written inside math delimiters when used in a notebook:
Purpose |
LaTeX source |
Rendered expression |
|---|---|---|
Subscript and exponent |
|
\(E_n\), \(x^{12}\) |
Fraction |
|
\(\frac{p^2}{2m}\) |
Square root |
|
\(\sqrt{x^2+y^2}\) |
Greek symbols |
|
\(\lambda\), \(\nu\), \(\psi\) |
Vector |
|
\(\vec{p}\) |
Derivative |
|
\(\frac{d^2x}{dt^2}\) |
Integral |
|
\(\int_0^L f(x)\,dx\) |
Absolute value |
|
\(\lvert\psi\rvert^2\) |
Scientific notation |
|
\(3.31\times10^{-19}\) |
Upright units and spacing |
|
\(5.00\,{\rm eV}\) |
Use upright text for units and a small space between a value and its unit. For example, $v=2.50\times10^6\,{\rm m/s}$ renders as \(v=2.50\times10^6\,{\rm m/s}\). Define symbols in the surrounding prose; typesetting an equation does not explain its meaning.
Equations with several lines#
The \begin{align} ... \end{align} environment structures a multiline mathematical display. The & marks the alignment position, usually before an equals sign, and \\ ends a line. Inspecting an existing course equation is a useful way to learn this structure:
\begin{align}
x' &= x-Ut, \\
\frac{dx'}{dt} &= \frac{dx}{dt}-U.
\end{align}
Here, the second line assumes that \(U\) is constant and the frames share the same time coordinate. The align environment already defines a mathematical display; it does not need an additional pair of dollar-sign delimiters. An alternative is \begin{aligned} ... \end{aligned} inside a $$ ... $$ display, as used in some notebook examples. Keep the opening and closing environment names matched.
Use the rocket ship to open a chapter in Colab, enter the relevant text cell’s editing mode, and inspect the source of a similar equation. Reuse the arrangement of fractions, derivatives, alignment marks, and line breaks while adapting the quantities to your solution. Use separate displays with explanatory sentences when a derivation requires reasoning between steps.
Code shown as text versus executable code#
Surround a short code expression with backticks when discussing it in a sentence. For example, writing `energy = h * frequency` displays energy = h * frequency.
To show several lines without executing them, use a fenced code block. The example below includes the opening and closing triple backticks:
```python
energy = h * frequency
print(energy)
```
A fenced block in a text cell displays code but does not run it. To perform the calculation, place the Python in a code cell and define h and frequency before using them. Keep the physical explanation in nearby text cells, and interpret the resulting output.
LaTeX math and Python use different syntax. A typeset equation might contain h\nu or x^2; the corresponding Python uses explicit multiplication, such as h * frequency, and x**2 for the square. Do not paste LaTeX commands into a Python calculation.
Small tables and figures#
A Markdown table is useful for a few values or a concise comparison. Separate columns with | and add a separator row beneath the headings:
| Quantity | Symbol | Value |
| --- | --- | --- |
| Photon frequency | $\nu$ | $5.00\times10^{14}\,{\rm Hz}$ |
| Photon energy | $E$ | $3.31\times10^{-19}\,{\rm J}$ |
Quantity |
Symbol |
Value |
|---|---|---|
Photon frequency |
\(\nu\) |
\(5.00\times10^{14}\,{\rm Hz}\) |
Photon energy |
\(E\) |
\(3.31\times10^{-19}\,{\rm J}\) |
These example values are related by \(E=h\nu\). A table presents the results compactly; the surrounding explanation should still identify the relationship and interpret the values.
Keep Python-generated figures with their code output. Label axes with quantities and units, and explain what the plot shows in a nearby text cell. If you insert an external image, make sure it is visible in both the notebook and exported PDF and include its source credit. A link to a file that exists only on your computer will not make that image available to another reader.
JupyterBook features and notebook portability#
The course website uses MyST, an extension of Markdown that supports JupyterBook features such as note and tip admonitions. For example, the source of a course-page tip can look like this:
```{tip}
Check the units before interpreting a numerical answer.
```
Note
Some commands in a chapter notebook format the JupyterBook webpage rather than your homework. Admonitions such as {note} and {tip}, equation directives such as {math}, their options such as :label:, and MyST cross-references such as {eq} are processed when the website is built and may not render in Colab. Copy the useful question text or LaTeX equation content, not these webpage wrappers. The colored labels in the homework example are also instructional aids and should be omitted from submissions.
For an equation inside a fenced {math} directive, copy only its mathematical content. Omit the directive fence and options, then enclose a single equation in $$ ... $$ or organize a multiline equation with the align environment shown above. A webpage equation label or cross-reference is not part of the physical equation. Render the adapted cell to check that the notation displays correctly.
Notes and tips should highlight occasional guidance. They should not replace the main explanation or appear as a succession of boxes.
Practice and final checks#
Create a short practice notebook with a chapter heading, a bold blockquoted question, a paragraph containing inline math, and a displayed equation. Render the cells and compare their appearance with the source. This small exercise prepares you to format your own analysis; it is not an additional submission unless assigned.
Before exporting your homework, check the following:
The question is bold and blockquoted, while your explanation is ordinary text.
Heading levels, paragraph breaks, and mathematical notation are consistent.
The writing satisfies the content and minimum-length guidance in the homework template.
Code has been run in order, and its output agrees with the accompanying explanation.
All cell editors are closed and text cells are rendered. Do not print an editing view with Markdown source and a partial preview in two columns, or collapse content needed in the PDF.
The saved PDF contains readable equations, figures, and complete text. Submit it together with the matching notebook, using a two-digit chapter number, such as
PHYS321_Chpt02_Quarles.ipynbandPHYS321_Chpt02_Quarles.pdf.
For additional syntax examples, consult the Jupyter Markdown documentation, the original Markdown syntax reference, and the MyST references for mathematics and admonitions.