Skip to main content

Getting Started with PreTeXt

Section Part 5. Add a Small Starter Lesson

The template book comes with placeholder content that’s fine but not very interesting to edit. Let’s replace a chunk of it with a short lesson you can actually work with.
  1. In the file explorer, open source/ and double-click main.ptx. You should see a PreTeXt document with a few <chapter> and <section> tags.
  2. Find the first <section> inside the first <chapter>. Select everything from the opening <section> tag through its closing </section>, and replace it with the block below.
    <section xml:id="sec-right-triangles">
      <title>Right Triangles</title>
    
      <p>This short lesson introduces right triangles and
      the Pythagorean theorem.</p>
    
      <definition xml:id="def-right-triangle">
        <statement>
          <p>A <term>right triangle</term> is a triangle
          with one angle measuring exactly 90 degrees.</p>
        </statement>
      </definition>
    
      <p>The Pythagorean theorem states that
      <m>a^2 + b^2 = c^2</m>, where <m>c</m> is the
      length of the hypotenuse.</p>
    
      <example>
        <title>A 3-4-5 triangle</title>
        <statement>
          <p>Show that a triangle with sides 3, 4, and 5
          is a right triangle.</p>
        </statement>
        <solution>
          <p>Check: <m>3^2 + 4^2 = 9 + 16 = 25 = 5^2</m>.</p>
        </solution>
      </example>
    
      <exercise>
        <statement>
          <p>Find the length of the hypotenuse of a right
          triangle with legs of length 5 and 12.</p>
        </statement>
      </exercise>
    
      <p>For a reminder of the terminology,
      see <xref ref="def-right-triangle"/>.</p>
    </section>
    
  3. Save the file: Ctrl+S on Windows/Linux, Cmd+S on Mac.

Make it yours.

If you have a few extra minutes, change the topic to something you actually teach. Swap the definition, rewrite the example, replace the exercise. The structure stays the same; only the content changes. This is the authoring rhythm you’ll use for everything you write in PreTeXt from here on out.