| Author | DaveJarvis <email> |
|---|---|
| Date | 2025-08-28 13:36:48 GMT-0700 |
| Commit | 3750e56fb7f8550d9823d6096abd15d817f6c0eb |
| Parent | fb895bb |
| Delta | 6 lines added, 697 lines removed, 691-line decrease |
| /** | ||
| - * Responsible for testing the http://www.davekoelle.com/alphanum.html | ||
| + * Tests <a href="http://www.davekoelle.com/alphanum.html">alphanum</a> | ||
| * implementation. | ||
| */ | ||
| public void test_Sort_UnsortedList_SortedAlphanumerically() { | ||
| final var expected = Arrays.asList( | ||
| + "01-introduction.md", | ||
| + "02-variables.md", | ||
| "10X Radonius", | ||
| "20X Radonius", | ||
| final var validator = new RangeValidator( lo + "-" + hi ); | ||
| - for( int i = lo; i < hi; i++ ) { | ||
| + for( var i = lo; i < hi; i++ ) { | ||
| assertTrue( validator.test( i ) ); | ||
| } | ||
| // Arbitrary end value. | ||
| - for( int i = lo; i < lo + 101; i++ ) { | ||
| + for( var i = lo; i < lo + 101; i++ ) { | ||
| assertTrue( validator.test( i ) ); | ||
| } | ||
| final var validator = new RangeValidator( "-" + hi ); | ||
| - for( int i = 1; i < hi; i++ ) { | ||
| + for( var i = 1; i < hi; i++ ) { | ||
| assertTrue( validator.test( i ) ); | ||
| } | ||
| -# Overview | ||
| - | ||
| -Typesetting PDF files entails the following: | ||
| - | ||
| -* Download and install typesetting software | ||
| -* Download a theme pack | ||
| - | ||
| -These are described in the subsequent sections. Once the requirements have been met, continue reading to learn how to typeset a document. | ||
| - | ||
| -# Download typesetter | ||
| - | ||
| -Download the typesetting software as follows: | ||
| - | ||
| -1. Start the text editor. | ||
| -1. Click **File → Export As → PDF**. | ||
| - * Note the following details (e.g., Windows X86 64-bit): | ||
| - * operating system name; | ||
| - * instruction set; and | ||
| - * architecture. | ||
| -1. Click the [link](https://wiki.contextgarden.net/Installation) in the dialog. | ||
| -1. Download the appropriate archive file. | ||
| - | ||
| -# Install typesetter | ||
| - | ||
| -This section describes the installation steps for various platforms. Follow the steps that apply to the computer's operating system: | ||
| - | ||
| -* [Windows](#windows) (includes Windows 7, Windows 10, and similar) | ||
| -* [Unix](#unix) (includes MacOS, FreeBSD, Linux, and similar) | ||
| - | ||
| -## Windows | ||
| - | ||
| -Proceed with a Windows installation of the typesetting software as follows: | ||
| - | ||
| -1. Extract the `.zip` file into `C:\Users\%USERNAME%\AppData\Local\context` (the "root" directory) | ||
| -1. Run **install.bat** to download and install the software. | ||
| - * If prompted, click **Run anyway** (or click **More info** first). | ||
| -1. Right-click [localpath.bat](https://gitlab.com/DaveJarvis/KeenWrite/-/raw/main/scripts/localpath.bat). | ||
| -1. Select **Save Link As** (or similar). | ||
| -1. Save the file to the typesetting software's "root" directory. | ||
| -1. Rename `localpath.bat.txt` to `localpath.bat`, if necessary. | ||
| -1. Run `localpath.bat` (to set and save the `PATH` environment variable). | ||
| - | ||
| -Installation is complete. Verify the installation as follows: | ||
| - | ||
| -1. Type: `context --version` | ||
| -1. Press `Enter`. | ||
| - | ||
| -If version information is displayed then the software is installed correctly. | ||
| - | ||
| -Continue by installing a [theme pack](#theme-pack). | ||
| - | ||
| -## Unix | ||
| - | ||
| -For Linux, MacOS, FreeBSD, and similar operating systems, proceed as follows: | ||
| - | ||
| -1. Create `$HOME/.local/bin/context` | ||
| -1. Extract the `.zip` file within `$HOME/.local/bin/context` | ||
| -1. Run `sh install.sh` | ||
| -1. Add `export PATH=$PATH:$HOME/.local/bin/context/tex/texmf-linux-64/bin` to the login script. | ||
| - | ||
| -Installation is complete. Verify the installation as follows: | ||
| - | ||
| -1. Open a new terminal (to export the new PATH setting). | ||
| -1. Type: `context --version` | ||
| -1. Press `Enter`. | ||
| - | ||
| -If version information is displayed then the software is installed correctly. | ||
| - | ||
| -Continue by installing a [theme pack](#theme-pack). | ||
| - | ||
| -# Theme pack | ||
| - | ||
| -A theme pack is a set of themes that define how documents appear when typeset. Broadly, themes are applied as follows: | ||
| - | ||
| -* Install a theme pack | ||
| -* Configure individual themes | ||
| - | ||
| -## Install theme pack | ||
| - | ||
| -Install and configure the default theme pack as follows: | ||
| - | ||
| -1. Download the <a href="https://gitlab.com/DaveJarvis/keenwrite-themes/-/releases/permalink/latest/downloads/theme-pack.zip">theme-pack.zip</a> archive. | ||
| -1. Extract archive into a known location. | ||
| -1. Start the text editor, if not already running. | ||
| -1. Click **Edit → Preferences**. | ||
| -1. Click **Typesetting**. | ||
| -1. Click **Browse** beside **Themes**. | ||
| -1. Navigate to the `themes` directory. | ||
| -1. Click **Open**. | ||
| -1. Click **OK**. | ||
| - | ||
| -The theme pack is installed. | ||
| - | ||
| -Each theme has its own requirements, described below. | ||
| - | ||
| -## Configure Boschet theme | ||
| - | ||
| -Download and install the following font families: | ||
| - | ||
| -* [Libre Baskerville](https://fonts.google.com/specimen/Libre+Baskerville) | ||
| -* [Archivo Narrow](https://fonts.google.com/specimen/Archivo+Narrow) | ||
| -* [Inconsolata](https://fonts.google.com/specimen/Inconsolata) | ||
| - | ||
| -The theme is configured. | ||
| - | ||
| -# Typeset single document | ||
| - | ||
| -Typeset a document as follows: | ||
| - | ||
| -1. Start the text editor, if not already running. | ||
| -1. Click **File → New** (or type `Ctrl+n`). | ||
| -1. Type in some text. | ||
| -1. Click **File → Export As → PDF** (or type `Ctrl+p`). | ||
| -1. Select a theme from the drop-down list. | ||
| -1. Click **OK** (or press `Enter`). | ||
| -1. Set the **File name** to the PDF file name. | ||
| -1. Click **Save**. | ||
| - | ||
| -The document is typeset; open the PDF file in a PDF reader to view the result. | ||
| - | ||
| -# Typeset multiple documents | ||
| - | ||
| -Typeset multiple documents similar to single documents, with one difference: | ||
| - | ||
| -* Click **File → Export As → Joined PDF** (or type `Ctrl+Shift+p`). | ||
| - | ||
| -All documents having the same file name extension in the same directory | ||
| -(or sub-directories) as the actively edited file are first concatenated then | ||
| -typeset into a single PDF document. The order that files are concatenated | ||
| -is numeric and alphabetic. | ||
| - | ||
| -For example, if `1.Rmd` is a sibling of the following files in the same | ||
| -directory, then all the files will be included in the PDF, as expected: | ||
| - | ||
| - chapter_1.Rmd | ||
| - chapter_2.Rmd | ||
| - chapter_2a.Rmd | ||
| - chapter_2b.Rmd | ||
| - chapter_3.Rmd | ||
| - chapter_10.Rmd | ||
| - | ||
| -Basically, sorting honours numbers and letters in file names. | ||
| - | ||
| -# Background | ||
| - | ||
| -This text editor helps keep content separated from presentation. Plain text documents will remain readable long after proprietary formats have become obsolete. However, we've come to expect much more in what we read than mere text: from hyperlinked tables of contents to indexes, from footers to footnotes, from mathematical expressions to complex graphics, modern documents are nuanced and multifaceted. | ||
| - | ||
| -## History | ||
| - | ||
| -Before computer-based typesetting, much of mathematics was put to page by hand. Professional typesetters, who were often expensive and usually not mathematicians, would inadvertently introduce typographic errors into equations. Phototypesetting technology improved upon hand-typesetting, but well-known computer scientist Donald Knuth---whose third volume of *The Art of Computer Programming* was phototypeset in 1976---expressed dissatisfaction with its typographic quality. He set himself two goals: let anyone create high-quality books without much effort and provide software that typesets consistently on all capable computers. Two years later, he released a typesetting system and a font description language: TeX and METAFONT, respectively. | ||
| - | ||
| -In short, TeX is software that helps typeset plain text documents. | ||
| - | ||
| -## ConTeXt | ||
| - | ||
| -Programming computers to typeset internationalized text automatically at the level we've become accustomed takes decades of development effort. Many free and open source software solutions can typeset text, including: ConTeXt, LaTeX, Sile, and others. ConTeXt, which builds upon TeX, is ideal for typesetting plain text into beautiful documents because it is developed with a notion of *setups*. These setups can wholly describe how text is to be typeset and---by being external to the text itself---configuring setups provides ample control over the document's final appearance without changing the prose. | ||
| - | ||
| -# Further reading | ||
| - | ||
| -Here are a few documents that introduce the typesetting system: | ||
| - | ||
| -* [What is ConTeXt?](https://www.pragma-ade.com/general/manuals/what-is-context.pdf) | ||
| -* [A not so short introduction to ConTeXt](https://github.com/contextgarden/not-so-short-introduction-to-context) | ||
| -* [Dealing with XML in ConTeXt MKIV](https://pragma-ade.com/general/manuals/xml-mkiv.pdf) | ||
| -* [Typographic Programming](https://www.pragma-ade.com/general/manuals/style.pdf) | ||
| - | ||
| -The [documentation library](https://wiki.contextgarden.net/Documentation) includes the following gems: | ||
| - | ||
| -* [ConTeXt Manual](https://www.pragma-ade.nl/general/manuals/ma-cb-en.pdf) | ||
| -* [ConTeXt command reference](https://www.pragma-ade.nl/general/qrcs/setup-en.pdf) | ||
| -* [METAFUN Manual](https://www.pragma-ade.nl/general/manuals/metafun-p.pdf) | ||
| -* [It's in the Details](https://www.pragma-ade.nl/general/manuals/details.pdf) | ||
| -* [Fonts out of ConTeXt](https://www.pragma-ade.com/general/manuals/fonts-mkiv.pdf) | ||
| - | ||
| -Expert-level documentation includes the [LuaTeX Reference Manual](https://www.pragma-ade.nl/general/manuals/luatex.pdf). | ||
| - | ||
| -# Skins | ||
| - | ||
| -The application provides bundled skins and the ability to add custom | ||
| -skins. This document describes the interplay between bundled skins | ||
| -and building your own look and feel. | ||
| - | ||
| -A skin is a set of styles, similar to cascading style sheet classes, | ||
| -that configures the user interface colours, fonts, spacing, highlights, | ||
| -drop-shadows, gradients, and more. | ||
| - | ||
| -For more information on CSS, see the [W3C CSS tutorial](https://www.w3.org/Style/Examples/011/firstcss). | ||
| - | ||
| -# Order | ||
| - | ||
| -The order that stylesheets are applied matters so that stylesheets can | ||
| -override styles defined previously. The application's user interface | ||
| -is made up of the following stylesheets, applied in the order listed: | ||
| - | ||
| -* **scene.css** --- Defines toolbar styling. | ||
| -* **markdown.css** --- Defines text editor styling. | ||
| -* **skins/skin_name.css** --- Bundled skin selected in preferences. | ||
| -* **custom.css** --- User-defined file set in preferences. | ||
| - | ||
| -# Customization | ||
| - | ||
| -Create a custom skin as follows: | ||
| - | ||
| -1. Start the application. | ||
| -1. Click **File → New** to create a new file. | ||
| -1. Click **File → Save As** to rename the file. | ||
| -1. Save the file as `custom.css`. | ||
| -1. Change the content to the following: | ||
| -``` css | ||
| -.root { | ||
| - -fx-base: rgb( 30, 30, 30 ); | ||
| - -fx-background: -fx-base; | ||
| -} | ||
| -``` | ||
| - | ||
| -Next, apply the skin as follows: | ||
| - | ||
| -1. Click **Edit → Preferences** to open the preferences dialog. | ||
| -1. Click **Skins** to view the available options. | ||
| -1. Click **Browse** to select a custom file. | ||
| -1. Browse to and select `custom.css`, created previously. | ||
| -1. Click **Open**. | ||
| -1. Click **Apply**. | ||
| - | ||
| -The user interface immediately changes to a dark mode. Continue: | ||
| - | ||
| -1. Click **OK** to close the dialog. | ||
| -1. Change the **rgb** numbers in **custom.css** from `30` to `60`. | ||
| -1. Click **File → Save** to save the CSS file. | ||
| - | ||
| -The user interface immediately changes colour. | ||
| - | ||
| -# Classes | ||
| - | ||
| -When creating your own skin, there many classes that can be styled. The | ||
| -previous section showed how to set up a rudimentary skin. Instead, start | ||
| -with a template that already has a number of classes defined so that you | ||
| -can tweak them to your taste. Accomplish this as follows: | ||
| - | ||
| -1. Visit the [skin](https://gitlab.com/DaveJarvis/KeenWrite/-/tree/main/src/main/resources/com/keenwrite/skins) repository directory | ||
| -1. Click one of the files (e.g., `haunted_grey.css`). | ||
| -1. Click **Raw**. | ||
| -1. Copy the entire text. | ||
| -1. Return to `custom.css`. | ||
| -1. Delete the contents. | ||
| -1. Paste the copied text. | ||
| -1. Save the file. | ||
| - | ||
| -To see how the CSS styles are applied to the text editor, open | ||
| -[markdown.css](https://gitlab.com/DaveJarvis/KeenWrite/-/blob/main/src/main/resources/com/keenwrite/editor/markdown.css), which is also in the repository. | ||
| - | ||
| -# Modena | ||
| - | ||
| -The basic look used by the application is _Modena Light_. Typically we | ||
| -only need to override a few classes to completely change the application's | ||
| -look and feel. For a full listing of available styles see the OpenJDK's | ||
| -[Modena CSS file](https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css). | ||
| - | ||
| -# JavaFX CSS | ||
| - | ||
| -The [Java CSS Reference Guide](https://openjfx.io/javadoc/21/javafx.graphics/javafx/scene/doc-files/cssref.html) is exhaustive. In addition to showing many | ||
| -differences between JavaFX CSS and W3C CSS, the guide introduces numerous | ||
| -helpful functions for manipulating colours and gradients using existing | ||
| -colour definitions. | ||
| - | ||
| -# RichTextFX | ||
| - | ||
| -The application uses RichTextFX to render the text editor. Styling various | ||
| -text editor classes can require using the prefix `-rtfx` instead of the | ||
| -regular JavaFX `-fx`. | ||
| - | ||
| -# Submit | ||
| - | ||
| -If you have a look that you'd like to contribute to the project, do pass | ||
| -it along. Either open a new issue in the [issue tracker](https://gitlab.com/DaveJarvis/KeenWrite/-/issues) that contains the CSS file or submit a pull request. | ||
| - | ||
| -# Fenced divs | ||
| - | ||
| -This section describes the syntax to generate HTML `div` elements. The | ||
| -syntax is known as a _fenced div_. | ||
| - | ||
| -# Basic syntax | ||
| - | ||
| -A fenced div has the following basic syntax: | ||
| - | ||
| -``` markdown | ||
| -::: name | ||
| -Content | ||
| -::: | ||
| -``` | ||
| - | ||
| -To start a fenced div, begin a line with at least three colons (`:::`), | ||
| -followed by at least one space, followed by any word. Content may follow | ||
| -immediately on the next line. Terminate the fenced div with at least | ||
| -three colons. The terminating colons needn't match in number to the starting | ||
| -colons, but it's a good idea to maintain symmetry. | ||
| - | ||
| -The HTML that is generated from the above fenced div will resemble: | ||
| - | ||
| -``` html | ||
| -<div class="name"> | ||
| -<p>Content</p> | ||
| -</div> | ||
| -``` | ||
| - | ||
| -# Extended syntax | ||
| - | ||
| -A fenced div may use an extended syntax. The extended syntax can provide | ||
| -a unique identifier, multiple class names, and key/value data pairs. For | ||
| -example: | ||
| - | ||
| -``` markdown | ||
| -::: {#poem-01 .stanza author="Emily Dickinson" year=1890} | ||
| -Because I could not stop for Death — | ||
| -He kindly stopped for me — | ||
| -The Carriage held but just Ourselves — | ||
| -And Immortality. | ||
| -::: | ||
| -``` | ||
| - | ||
| -The above snippet produces: | ||
| - | ||
| -``` html | ||
| -<div id="poem-01" class="stanza" data-author="Emily Dickinson" data-year="1890"> | ||
| -<p>Because I could not stop for Death — | ||
| -He kindly stopped for me — | ||
| -The Carriage held but just Ourselves — | ||
| -And Immortality.</p> | ||
| -</div> | ||
| -``` | ||
| - | ||
| -Note that when using the extended syntax, class styles must be prefixed with | ||
| -a period (e.g., `.stanza` in the example). | ||
| - | ||
| -# Nested syntax | ||
| - | ||
| -Fenced divs may be nested, such as in the following example: | ||
| - | ||
| -``` markdown | ||
| -::: poem | ||
| -:::::: stanza | ||
| -Because I could not stop for Death — | ||
| -He kindly stopped for me — | ||
| -The Carriage held but just Ourselves — | ||
| -And Immortality. | ||
| -:::::: | ||
| -::: | ||
| -``` | ||
| - | ||
| -The above example produces: | ||
| - | ||
| -``` html | ||
| -<div class="poem"><div class="stanza"> | ||
| -<p>Because I could not stop for Death — | ||
| -He kindly stopped for me — | ||
| -The Carriage held but just Ourselves — | ||
| -And Immortality.</p> | ||
| -</div></div> | ||
| -``` | ||
| - | ||
| -# Quotation marks | ||
| - | ||
| -When converting straight single quotes into curled single quotes, the | ||
| -application offers a variety of entities to use for encoding: | ||
| - | ||
| -* **regular** -- Do not encode. | ||
| -* **modifier** -- Encode as \ʼ, the modifier letter apostrophe. | ||
| -* **apos** -- Encode as \', curled when typeset to PDF. | ||
| -* **aposhex** -- Encode as \', the apostrophe's numeric value. | ||
| -* **quote** -- Encode as \’, the right single quotation mark, which | ||
| -is typically curled in HTML and XHTML documents by default. | ||
| -* **quotehex** -- Encode \’, the right single quotation mark's numeric | ||
| -value. | ||
| - | ||
| -When typsetting into a PDF document, only the semantically correct value | ||
| -of \' will be curled automatically. | ||
| - | ||
| -# History | ||
| - | ||
| -Quotation marks trace back to Ancient Greek, later adopted to the diplé (⸖) | ||
| -circa 625 BCE, foreshadowing its later curve. By the seventeenth century, | ||
| -quotation marks grew common. During the nineteenth century, Western Europe | ||
| -turned the convexity of quotation mark pairs outward. | ||
| - | ||
| -Early mechanical typewriters, circa 1825, lacked many punctuation marks. As | ||
| -technology improved, additional keys were added while some keys played dual | ||
| -roles (such as I for 1). Straight single and double quotes could be co-opted | ||
| -for quotation marks and apostrophes, feet and inches marks, and primes and | ||
| -double-primes. There wasn't a pressing need to type curled versions because | ||
| -humans excel at understanding from context. | ||
| - | ||
| -Eventually straight quotes were codified for computers. Unfortunately, the | ||
| -apostrophe carried with it the baggage from typewriters. That is, burgeoning | ||
| -encoding standards failed to let users capture the nuances of the English | ||
| -language; computers forced users to treat the apostrophe as a straight quote. | ||
| -Standards bodies suggested using the right single quotation mark for an | ||
| -apostrophe instead, shirking off its semantic meaning. Consequently, | ||
| -text containing English quotations, especially British English, is now | ||
| -riddled with ambiguity. | ||
| - | ||
| -Consider the sentence: | ||
| - | ||
| -> Ambiguity lurks in "'cause the horses'". | ||
| - | ||
| -Does `'cause` mean _because_ or _induce_? The answer determines whether | ||
| -an open left single quote is used or an apostrophe, semantically speaking. | ||
| -It's amazing how ancient decisions still affect modern systems. | ||
| - | ||
| -# Internationalization | ||
| - | ||
| -The application supports internationalization (I18N). There are multiple | ||
| -components to editing and previewing internationalized text documents. | ||
| -These include: | ||
| - | ||
| -* Fonts | ||
| -* Language | ||
| - | ||
| -Both fonts and language must be set for non-Latin-based text. | ||
| - | ||
| -# Fonts | ||
| - | ||
| -The text editors and preview panel have independent font settings. For | ||
| -all Chinese, Japanese, and Korean (CJK) fonts, you may have to type in | ||
| -the font family name directly. | ||
| - | ||
| -For example, CJK font families for the editor have the following names: | ||
| - | ||
| -* **Noto Sans CJK KR** --- Korean font | ||
| -* **Noto Sans CJK JP** --- Japanese font | ||
| -* **Noto Sans CJK HN** --- Chinese font | ||
| -* **Noto Sans CJK SC** --- Simplified Chinese font | ||
| - | ||
| -While CJK font families for the preview have the following names: | ||
| - | ||
| -* **Noto Serif CJK KR** --- Korean font | ||
| -* **Noto Serif CJK JP** --- Japanese font | ||
| -* **Noto Serif CJK HN** --- Chinese font | ||
| -* **Noto Serif CJK SC** --- Simplified Chinese font | ||
| - | ||
| -## Editor | ||
| - | ||
| -Complete the following steps to change the editor font: | ||
| - | ||
| -1. Click **Edit → Preferences**. | ||
| -1. Click **Fonts**. | ||
| -1. Click **Change** under **Editor Font**. | ||
| -1. Find the font name by typing or scrolling. | ||
| -1. Click the desired font family. | ||
| -1. Click **OK**. | ||
| -1. Click **Apply**. | ||
| - | ||
| -The text editor font is changed. | ||
| - | ||
| -Note the following: | ||
| - | ||
| -* The font must be installed in the system for this to work. | ||
| -* You may have to edit the font name if it cannot be selected from the list. | ||
| -* Setting the editor font also sets the statistics panel font. | ||
| - | ||
| -## Preview | ||
| - | ||
| -The preview panel uses regular and monospace fonts. | ||
| - | ||
| -### Regular | ||
| - | ||
| -Complete the following steps to change the regular preview font: | ||
| - | ||
| -1. Click **Edit → Preferences**. | ||
| -1. Click **Fonts**. | ||
| -1. Click **Change** under **Preview Font** for the **Preview pane font name**. | ||
| -1. Find the font name by typing or scrolling. | ||
| -1. Click the desired font family. | ||
| -1. Click **OK**. | ||
| -1. Click **Apply**. | ||
| - | ||
| -The regular preview font is changed. | ||
| - | ||
| -### Monospace | ||
| - | ||
| -Complete the following steps to change the monospace preview font: | ||
| - | ||
| -1. Click **Edit → Preferences**. | ||
| -1. Click **Fonts**. | ||
| -1. Click **Change** under **Preview Font** for the **Monospace font name**. | ||
| -1. Find the font name by typing or scrolling. | ||
| -1. Click the desired font family. | ||
| -1. Click **OK**. | ||
| -1. Click **Apply**. | ||
| - | ||
| -The monospace font is changed. | ||
| - | ||
| -# Language | ||
| - | ||
| -Language settings control the locale that the application uses. When using | ||
| -a CJK font, for example, the application must also be instructed to use | ||
| -a particular locale. Change the locale as follows: | ||
| - | ||
| -1. Click **Edit → Preferences**. | ||
| -1. Click **Language**. | ||
| -1. Select a value for **Locale**. | ||
| -1. Click **Apply**. | ||
| - | ||
| -The language is set. | ||
| - | ||
| -# Captions and cross-references | ||
| - | ||
| -Users may define captions and cross-references to tables, figures, | ||
| -and equations. Unfortunately, at time of writing, the CommonMark | ||
| -specification is frozen. This means cross-references must be implemented | ||
| -as an extension to the Markdown specification, leaving the door open for | ||
| -differing Markdown rendering libraries and applications to diverge with | ||
| -respect to syntax. | ||
| - | ||
| -# Syntax | ||
| - | ||
| -This section describes how to use captions and cross-references within | ||
| -Markdown documents. The CommonMark standard details different ways to | ||
| -add captions to tables and figures. While those are supported, a more | ||
| -consistent syntax has been implemented. | ||
| - | ||
| -## Captions | ||
| - | ||
| -Tables, figures, and equations are captioned using the same syntax. In | ||
| -general, a line that starts with a double colon after a blank line will | ||
| -result in a caption added to the item immediately preceding it. The | ||
| -remainder of this section provides examples. | ||
| - | ||
| -### Images | ||
| - | ||
| -An image caption: | ||
| - | ||
| -``` | ||
| - | ||
| - | ||
| -:: Figure caption text | ||
| -``` | ||
| - | ||
| -### Table | ||
| - | ||
| -A table caption: | ||
| - | ||
| -``` | ||
| -| a | b | c | | ||
| -|---|---|---| | ||
| -| 1 | 2 | 3 | | ||
| -| 4 | 5 | 6 | | ||
| -| 7 | 8 | 9 | | ||
| - | ||
| -:: Table caption text | ||
| -``` | ||
| - | ||
| -### Equation | ||
| - | ||
| -An equation caption: | ||
| - | ||
| -``` | ||
| -$$E = mc^2$$ | ||
| - | ||
| -:: Equation caption | ||
| -``` | ||
| - | ||
| -# Cross-references | ||
| - | ||
| -There are two parts to a cross-reference: the anchor name and its references. | ||
| -An anchor name must be uniquely defined. Any number of references may refer | ||
| -to an anchor name. Anchor names can be associated with any item in the | ||
| -document, and are primarily added to captions. | ||
| - | ||
| -The general syntax for anchor names and references is: | ||
| - | ||
| -* `{#type-name:label}` (anchor name) | ||
| -* `[@type-name:label]` (reference) | ||
| - | ||
| -The `type-name` can be any alphanumeric value, starting with a letter or | ||
| -ideogram. Type names are user-defined categories for the item type. Labels | ||
| -are user-defined identifiers that must be unique per item. | ||
| - | ||
| -Consider the following example: | ||
| - | ||
| -``` | ||
| -In [@fig:animal], a cute animal is shown. | ||
| - | ||
| - | ||
| - | ||
| -:: World's cutest animal {#fig:animal} | ||
| - | ||
| -There is no cuter animal than the one in [@fig:animal]. | ||
| -``` | ||
| - | ||
| -The anchor name uniquely defines where an item in a document is located. Any | ||
| -number of references, anywhere in the document, may reference an anchor name. | ||
| -There are few restrictions placed on the possible type names and labels. Here | ||
| -are a few more anchor name examples: | ||
| - | ||
| -``` | ||
| -{#fig:cats} | ||
| -{#図版:猫} | ||
| -{#eq:mass-energy} | ||
| -{#eqn:laplace} | ||
| -``` | ||
| - | ||
| -## Type names | ||
| - | ||
| -To avoid duplicating writing the label each time (e.g., Figure, Table, | ||
| -Equation), there are a number of predefined labels associated with | ||
| -type names. The following table lists the type names and the label | ||
| -generated by the typesetting system: | ||
| - | ||
| -| Type name | English name | | ||
| -|-----------|--------------| | ||
| -| algorithm | Algorithm | | ||
| -| alg | Algorithm | | ||
| -| equation | Equation | | ||
| -| eqn | Equation | | ||
| -| eq | Equation | | ||
| -| figure | Figure | | ||
| -| fig | Figure | | ||
| -| formula | Formula | | ||
| -| listing | Listing | | ||
| -| list | Listing | | ||
| -| lst | Listing | | ||
| -| lyric | Lyrics | | ||
| -| music | Score | | ||
| -| score | Score | | ||
| -| source | Listing | | ||
| -| src | Listing | | ||
| -| tab | Table | | ||
| -| table | Table | | ||
| -| tbl | Table | | ||
| - | ||
| -These values are defined in the theme's `xhtml/xml-references.tex` file. | ||
| -# Credits | ||
| - | ||
| -Using libraries from: | ||
| - | ||
| -* Tomas Mikula: [RichTextFX](https://github.com/TomasMikula/RichTextFX), [WellBehavedFX](https://github.com/TomasMikula/WellBehavedFX), [Flowless](https://github.com/TomasMikula/Flowless), and [UndoFX](https://github.com/TomasMikula/UndoFX) | ||
| -* Jens Deters: [FontAwesomeFX](https://bitbucket.org/Jerady/fontawesomefx) | ||
| -* Dieter Holz: [PreferencesFX](https://github.com/dlsc-software-consulting-gmbh/PreferencesFX) | ||
| -* David Croft: [File Preferences](http://www.davidc.net/programming/java/java-preferences-using-file-backing-store) | ||
| -* Alex Bertram: [Renjin](https://www.renjin.org/) | ||
| -* Vladimir Schneider: [flexmark](https://github.com/vsch/flexmark-java) | ||
| -* Alberto Fernández, Shy Shalom, Kohei Taketa: [juniversalchardet](https://github.com/takscape/juniversalchardet) | ||
| -* Morten Nobel-Jørgensen: [Java Image Scaling](https://github.com/mortennobel/java-image-scaling) | ||
| - | ||
| -Inspired by: | ||
| - | ||
| -* Karl Tauber: [Markdown Writer FX](https://github.com/JFormDesigner/markdown-writer-fx) | ||
| -# Variables | ||
| - | ||
| -Diagrams that include variables: | ||
| - | ||
| - | ||
| - | ||
| - | ||
| - | ||
| -# PDF themes | ||
| - | ||
| -In the background of the following screenshot, the editor shows a novel | ||
| -being edited: | ||
| - | ||
| - | ||
| - | ||
| -Highlighted items of note: | ||
| - | ||
| -* PDF icon in the upper-left | ||
| -* Novel metadata as integrated variables towards the top-left | ||
| -* Theme selection dialog in the upper-middle | ||
| -* Three different styles, including: | ||
| - * Boschet, based on Baskerville font, nicely styled | ||
| - * Handrit, based on Courier font, double-spaced, manuscript format | ||
| - * Tarmes, based on Times Roman font, minimal styling | ||
| -* Variations in page numbers | ||
| -* Manuscript includes word count, automatically | ||
| -* Preferences dialog in the middle | ||
| - | ||
| -# Internationalization | ||
| - | ||
| -Poem with locale settings: | ||
| - | ||
| - | ||
| - | ||
| -# Equations | ||
| - | ||
| -TeX equations with detached preview: | ||
| - | ||
| - | ||
| - | ||
| -# Dockable tabs | ||
| - | ||
| -Document outline opened and docked in bottom-left corner: | ||
| - | ||
| - | ||
| - | ||