Skip to content

Commit

Permalink
Merge pull request #3 from pandoc-ext/correct-specimens
Browse files Browse the repository at this point in the history
Improved example specimens and README after review
  • Loading branch information
nandac authored Jun 30, 2024
2 parents a62c5b6 + 9c4b015 commit 244dc59
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 59 deletions.
60 changes: 30 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ The filter defines several classes for styling fonts and text alignment.

The following classes have been defined for the various _font styles_ that are supported:

| Class | Short Hand | Inline LaTeX | Block LaTeX | Description |
|-------------|------------|----------------|-------------------------------------|---------------------------|
| `bold` | `bf` | `\textbf{...}` | `\begin{bfseries}...\end{bfseries}` | Bold font series/weight.|
| `emphasis` | `em` | `\emph{...}` | `\begin{em}...\end{em}` | Emphasis font. |
| `italic` | `it` | `\textit{...}` | `\begin{itshape}...\end{itshape}` | Italic font shape. |
| `lower` | N/A | `\lowercase{...}` | N/A | Lowercase font; not available for blocks. |
| `medium` | `md` | `\textmd{...}` | `\begin{mdseries}...\end{mdseries}` | Medium font series. |
| `monospace` | `tt` | `\texttt{...}` | `\begin{ttfamily}...\end{ttfamily}` | Monospace font family. |
| `normalfont`| `nf` | `\textnormal{...}` | `\begin{normalfont}...\end{normalfont}` | Normal font. |
| `sans` | `sf` | `\textsf{...}` | `\begin{sffamily}...\end{sffamily}` | Sans-serif font family. |
| `serif` | `rm` | `\textrm{...}` | `\begin{rmfamily}...\end{rmfamily}` | Serif font family. |
| `upper` | N/A | `\uppercase{...}` | N/A | Uppercase font; not available for blocks.
| `upright` | `up` | `\textup{...}` | `\begin{upshape}...\end{upshape}` | Upright font shape.
| `smallcaps` | `sc` | `\textsc{...}` | `\begin{scshape}...\end{scshape}` | Small capitals font shape. |
| CSS Class | Short Hand | Inline LaTeX | Block LaTeX | Description |
|-------------|------------|--------------------|-----------------------------------------|----------------------------|
| `bold` | `bf` | `\textbf{...}` | `\begin{bfseries}...\end{bfseries}` | Bold font series/weight. |
| `emphasis` | `em` | `\emph{...}` | `\begin{em}...\end{em}` | Emphasis font. |
| `italic` | `it` | `\textit{...}` | `\begin{itshape}...\end{itshape}` | Italic font shape. |
| `lower` | None | `\lowercase{...}` | Not available for blocks. | Lowercase font. |
| `medium` | `md` | `\textmd{...}` | `\begin{mdseries}...\end{mdseries}` | Medium font series. |
| `monospace` | `tt` | `\texttt{...}` | `\begin{ttfamily}...\end{ttfamily}` | Monospace font family. |
| `normalfont`| `nf` | `\textnormal{...}` | `\begin{normalfont}...\end{normalfont}` | Normal font. |
| `sans` | `sf` | `\textsf{...}` | `\begin{sffamily}...\end{sffamily}` | Sans-serif font family. |
| `serif` | `rm` | `\textrm{...}` | `\begin{rmfamily}...\end{rmfamily}` | Serif font family. |
| `upper` | None | `\uppercase{...}` | Not available for blocks. | Uppercase font |
| `upright` | `up` | `\textup{...}` | `\begin{upshape}...\end{upshape}` | Upright font shape. |
| `smallcaps` | `sc` | `\textsc{...}` | `\begin{scshape}...\end{scshape}` | Small capitals font shape. |

The `\emph` command has been added purely for completeness and we encourage users to use Pandoc Markdown's built in support for emphasis whenever possible.

Expand All @@ -86,26 +86,26 @@ The `\Huge` LaTeX size has been omitted as it does not produce any significant i

The following _text-alignments_ are defined for block elements exclusively:

| Class | LaTeX code | Description |
|---------------|-------------------------------------------|-----------------------------------------------------------------------------|
| `center` | `\begin{center}...\end{center}` | Center a block of text, |
| `flushright` | `\begin{flushright}...\end{flushright}` | Right justify a block of text. |
| `flushleft` | `\begin{flushleft}...\end{flushleft}` | Left justify a block of text. |
| CSS Class | LaTeX code | Description |
|---------------|-------------------------------------------|------------------------------------------------------------------------------------|
| `center` | `\begin{center}...\end{center}` | Center a block of text, |
| `flushright` | `\begin{flushright}...\end{flushright}` | Right justify a block of text. |
| `flushleft` | `\begin{flushleft}...\end{flushleft}` | Left justify a block of text. |
| `centering` | `\begin{centering}...\end{centering}` | Center a block of text with user-defined line breaks using backslash (`\`). |
| `raggedleft` | `\begin{raggedleft}...\end{raggedleft}` | Right justify a block of text with user-defined line breaks using backslash (`\`). |
| `raggedright` | `\begin{raggedright}...\end{raggedright}` | Left justify a block of text with user-defined line breaks using backslash (`\`). |

While not widely used, _additional font styles_ such as underlining, strikeout etc., may be required from time to time. Pandoc already directly supports strikeout, for example. For the sake of completeness the following additional font styles, provided by the `ulem` LaTeX package, are available only for inline elements:

| Class | Short Hand | LaTeX code | Description |
|-------------|------------|-------------------|------------------------------------------------|
| `dashuline` | `dau` | `\dashuline{...}` | Dashed underline. |
| `dotuline` | `dou` | `\dotuline{...}` | Dotted underline like. |
| `uline` | `u` | `\uline{...}` | Underline. |
| `uuline` | `uu` | `\uuline{...}` | Double underline. |
| `uwave` | `uw` | `\uwave{...}` | Wavy underline. |
| `sout` | `so` | `\sout{...}` | Stricken out line. |
| `xout` | `xo` | `\xout{...}` | Marked over line; not available for HTML. |
While not widely used, _additional font styles_ such as underlining, strikeout etc., may be required from time to time. Pandoc already supports strikeout but For the sake of completeness the following additional font styles -- provided by the `ulem` LaTeX package -- are available only for inline elements:

| CSS Class | Short Hand | LaTeX code | Description |
|--------------------------|------------|-------------------|------------------------|
| `dashuline` | `dau` | `\dashuline{...}` | Dashed underline. |
| `dotuline` | `dou` | `\dotuline{...}` | Dotted underline like. |
| `uline` | `u` | `\uline{...}` | Underline. |
| `uuline` | `uu` | `\uuline{...}` | Double underline. |
| `uwave` | `uw` | `\uwave{...}` | Wavy underline. |
| `sout` | `so` | `\sout{...}` | Stricken out line. |
| Not available for HTML. | None | `\xout{...}` | Marked over line. |

The `ulem` LaTeX package is not invoked by default and must be explicitly specified as a metadata attribute, in your defaults file, source document, or on the command line. In a defaults file you may specify the `ulem_styles` attribute using the `metadata` field like so:

Expand Down
9 changes: 5 additions & 4 deletions specimens/specimen.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ <h3 id="sans-serif-font-inline">Sans-serif Font Inline</h3>
ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.</p>
<h3 id="serif-font-inline">Serif Font Inline</h3>
<p><span class="serif">This text should be in serif.</span> <span
class="sans">Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua</span>.</p>
<div class="sans">
<p><span class="serif">This text should be in serif.</span> Lorem ipsum
dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.</p>
</div>
<h3 id="slanted-font-inline">Slanted Font Inline</h3>
<p><span class="slanted">This text should be slanted.</span> Lorem ipsum
dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
Expand Down
Binary file modified specimens/specimen.pdf
Binary file not shown.
45 changes: 22 additions & 23 deletions test/expected.native
Original file line number Diff line number Diff line change
Expand Up @@ -517,27 +517,27 @@
3
( "serif-font-inline" , [] , [] )
[ Str "Serif" , Space , Str "Font" , Space , Str "Inline" ]
, Para
[ Span
( "" , [ "serif" ] , [] )
[ RawInline (Format "latex") "\\textrm{"
, Str "This"
, Space
, Str "text"
, Space
, Str "should"
, Space
, Str "be"
, Space
, Str "in"
, Div
( "" , [ "sans" ] , [] )
[ RawBlock (Format "latex") "\\begin{sffamily}"
, Para
[ Span
( "" , [ "serif" ] , [] )
[ RawInline (Format "latex") "\\textrm{"
, Str "This"
, Space
, Str "text"
, Space
, Str "should"
, Space
, Str "be"
, Space
, Str "in"
, Space
, Str "serif."
, RawInline (Format "latex") "}"
]
, Space
, Str "serif."
, RawInline (Format "latex") "}"
]
, Space
, Span
( "" , [ "sans" ] , [] )
[ RawInline (Format "latex") "\\textsf{"
, Str "Lorem"
, Space
, Str "ipsum"
Expand Down Expand Up @@ -574,10 +574,9 @@
, Space
, Str "magna"
, Space
, Str "aliqua"
, RawInline (Format "latex") "}"
, Str "aliqua."
]
, Str "."
, RawBlock (Format "latex") "\\end{sffamily}"
]
, Header
3
Expand Down
6 changes: 4 additions & 2 deletions test/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ et dolore magna aliqua.

### Serif Font Inline

[This text should be in serif.]{.serif} [Lorem ipsum dolor sit amet,
::: sans
[This text should be in serif.]{.serif} Lorem ipsum dolor sit amet,
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua]{.sans}.
et dolore magna aliqua.
:::

### Slanted Font Inline

Expand Down

0 comments on commit 244dc59

Please sign in to comment.