XML technologies / ePUB / Open Publication Structure / Text structure and character formatting / Character formatting

(Excerpt from “E-Books mit ePUB ─ Von Word zum E-Book mit XML” by Dr. Victor Wang)

For character formatting, the common ground is limited to superscript (<sup>), subscript (<sub>), emphasis (<em>) and strong emphasis (<strong>) elements shared by XHTML and DTBook.

XHTML additionally permits classic, purely typographic bold (<b>), italic (<i>), small text (<small>) and large text (<big>). The example uses every character format permitted in XHTML.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
  <head/>
  <body>
    <div class="Dokument">
      <h1>Zeichenformate XHTML</h1>
      <p>a) <strong>em</strong> / <strong>strong</strong>: Eine Texthervorhebung sollte <em>immer</em> einen inhaltlichen Grund haben. Bitte <strong>niemals</strong> willkürliche Hervorhebungen benutzen, das versteht kein Leser.</p>
      <p>b) <strong>i</strong> / <strong>b</strong>: In XHTML sind darüber hinaus auch <i>kursiv</i> oder <b>fett</b> als rein typografische Zeichenformate zugelassen.</p>
      <p>c) <strong>small</strong> / <strong>large</strong>: Des Weiteren gibt es in XHTML auch Zeichenformate für Schriftgrößen: <code>small</code> dient der Strukturierung von <small>Kleinschrift</small>, <code>big</code> der von <big>Großschrift</big>.</p>
      <p>d) <strong>sup</strong> und <strong>sub</strong>: Hoch- und Tiefstellung kommt nicht nur in Formeln vor.</p>
      <p>Der bekannte Satz des Pythagoras lautet: x<sub>1</sub><sup>2</sup> + x<sub>2</sub><sup>2</sup> = x<sub>3</sub><sup>2</sup></p>
      <p>Dabei sind x<sub>1</sub> und x<sub>2</sub> die Katheten und x<sub>3</sub> die Hypotenuse in einem rechtwinkligen Dreieck.</p>      
    </div>
  </body>
</html> 

Code example: Character formatting in XHTML

Adobe Digital Editions and iBooks display the example as follows:

XHTML character formatting (Adobe Digital Editions) XHTML character formatting (iBooks)

Figure: XHTML character formatting (Adobe Digital Editions and iBooks)

A note about the often-neglected elements <em> and <strong>: both are semantic elements whose appearance is determined by the stylesheet, reading software or browser. Thus, <em> may appear italic and <strong> bold. To ensure this explicitly, the cleanest approach, separating structure and layout, is to define it in the stylesheet. This also explains why DTBook omits the purely presentational elements <i> and <b>.

   

 

 

 

back to top