| 1 |
// |
| 2 |
// tex2mn 0.5.0 - converts Metanorma documents from LaTeX to AsciiDoc |
| 3 |
// |
| 4 |
// Copyright (C) 2019-2020 Ribose Inc. <[email protected]> |
| 5 |
// This project is available under the terms of the MIT License. |
| 6 |
// |
| 7 |
|
| 8 |
= tex2mn manual |
| 9 |
:epoch: 1574615272 |
| 10 |
:ctan-pkg-url: https://ctan.org/pkg |
| 11 |
:repo-url: https://github.com/metanorma/tex2mn |
| 12 |
:repo-tag: master |
| 13 |
:repo-blob-url: {repo-url}/blob/{repo-tag} |
| 14 |
:repo-tree-url: {repo-url}/tree/{repo-tag} |
| 15 |
:toc: |
| 16 |
:toclevels: 5 |
| 17 |
|
| 18 |
:leveloffset: +1 |
| 19 |
|
| 20 |
= Reading the manual |
| 21 |
|
| 22 |
Since `tex2mn` is a tool to transform `LaTeX` source files, some familiarity with `LaTeX` and its de-facto standard packages is assumed. |
| 23 |
|
| 24 |
We will graphically differentiate between: |
| 25 |
|
| 26 |
* `\standard` well-known macros which have standard behaviour, and |
| 27 |
* `*\NonStandard*` macros which are unique to `tex2mn` and will be documented thoroughly. |
| 28 |
|
| 29 |
[NOTE] |
| 30 |
==== |
| 31 |
In either case we will point out which `LaTeX` packages are used to define them (if any). |
| 32 |
==== |
| 33 |
|
| 34 |
Code samples will _always_ be presented as pairs of equivalent `LaTeX`/`AsciiDoc` listings to help you acquaint with both regardless of which side you're more familiar with: |
| 35 |
|
| 36 |
[cols="5a,4a"] |
| 37 |
|=== |
| 38 |
|[source,latex] |
| 39 |
---- |
| 40 |
What a \textbf{bold} statement. |
| 41 |
---- |
| 42 |
|[source,asciidoc] |
| 43 |
---- |
| 44 |
What a *bold* statement. |
| 45 |
---- |
| 46 |
|=== |
| 47 |
|
| 48 |
That's it. |
| 49 |
You can confidently start reading, now! |
| 50 |
|
| 51 |
If you happen to find any unexpected behaviour in the software or lack of clarity in the manual, please report it on our {repo-url}/issues[issue tracker] to help us make this tool better for everyone. |
| 52 |
|
| 53 |
:leveloffset!: |
| 54 |
|
| 55 |
== Document |
| 56 |
:leveloffset: +2 |
| 57 |
|
| 58 |
= Document title |
| 59 |
|
| 60 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_title.rb[test_title.rb]. |
| 61 |
|
| 62 |
You can define the document's title by using the `\title` macro _in the preamble_: |
| 63 |
|
| 64 |
[cols="a,a"] |
| 65 |
|=== |
| 66 |
|[source,latex] |
| 67 |
---- |
| 68 |
\documentclass{metanorma} |
| 69 |
\title{My first document} |
| 70 |
\begin{document} |
| 71 |
Document contents here. |
| 72 |
\end{document} |
| 73 |
---- |
| 74 |
|[source,asciidoc] |
| 75 |
---- |
| 76 |
= My first document |
| 77 |
|
| 78 |
Document contents here. |
| 79 |
---- |
| 80 |
|=== |
| 81 |
|
| 82 |
:leveloffset!: |
| 83 |
:leveloffset: +2 |
| 84 |
|
| 85 |
= Document attributes |
| 86 |
|
| 87 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_document_attributes.rb[test_document_attributes.rb]. |
| 88 |
|
| 89 |
Document attributes are global metadata that can be interpreted by `metanorma` when processing the `AsciiDoc` output. |
| 90 |
Which attributes you should use depend upon the Metanorma flavour you're targeting. |
| 91 |
Attributes supported by most Metanorma flavours can be found in the https://www.metanorma.com/author/ref/document-attributes/[generic attributes reference]. |
| 92 |
|
| 93 |
You can define a document attribute by using the `*\set*` macro _in the preamble_: |
| 94 |
|
| 95 |
[cols="a,a"] |
| 96 |
|=== |
| 97 |
|[source,latex] |
| 98 |
---- |
| 99 |
\documentclass{metanorma} |
| 100 |
\set{my-attribute}{foobar} |
| 101 |
\begin{document} |
| 102 |
Document contents here. |
| 103 |
\end{document} |
| 104 |
---- |
| 105 |
|[source,asciidoc] |
| 106 |
---- |
| 107 |
:my-attribute: foobar |
| 108 |
|
| 109 |
Document contents here. |
| 110 |
---- |
| 111 |
|=== |
| 112 |
|
| 113 |
You can define a boolean attribute by using the `*\set*` with an empty argument: |
| 114 |
|
| 115 |
[cols="a,a"] |
| 116 |
|=== |
| 117 |
|[source,latex] |
| 118 |
---- |
| 119 |
\documentclass{metanorma} |
| 120 |
\set{my-boolean-attribute}{} |
| 121 |
\begin{document} |
| 122 |
Document contents here. |
| 123 |
\end{document} |
| 124 |
---- |
| 125 |
|[source,asciidoc] |
| 126 |
---- |
| 127 |
:my-boolean-attribute: |
| 128 |
|
| 129 |
Document contents here. |
| 130 |
---- |
| 131 |
|=== |
| 132 |
|
| 133 |
|
| 134 |
You can use an attribute's value by using the `*\get*` macro: |
| 135 |
|
| 136 |
[cols="a,a"] |
| 137 |
|=== |
| 138 |
|[source,latex] |
| 139 |
---- |
| 140 |
\documentclass{metanorma} |
| 141 |
\set{my-attribute}{some value} |
| 142 |
\begin{document} |
| 143 |
The attribute value is \get{my-attribute}. |
| 144 |
\end{document} |
| 145 |
---- |
| 146 |
|[source,asciidoc] |
| 147 |
---- |
| 148 |
:my-attribute: some value |
| 149 |
|
| 150 |
The attribute's value is {my-attribute}. |
| 151 |
---- |
| 152 |
|=== |
| 153 |
|
| 154 |
:leveloffset!: |
| 155 |
:leveloffset: +2 |
| 156 |
|
| 157 |
= Document authors |
| 158 |
|
| 159 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_document_authors.rb[test_document_authors.rb]. |
| 160 |
|
| 161 |
Document authors are handled as document attributes. |
| 162 |
|
| 163 |
You can `*\set*` a single author by specifying it in the preamble: |
| 164 |
|
| 165 |
[cols="a,a"] |
| 166 |
|=== |
| 167 |
|[source,latex] |
| 168 |
---- |
| 169 |
\documentclass{metanorma} |
| 170 |
\set{author}{John Doe} |
| 171 |
\begin{document} |
| 172 |
Document authored by \get{author}. |
| 173 |
\end{document} |
| 174 |
---- |
| 175 |
|[source,asciidoc] |
| 176 |
---- |
| 177 |
:author: John Doe |
| 178 |
|
| 179 |
Document authored by {author}. |
| 180 |
---- |
| 181 |
|=== |
| 182 |
|
| 183 |
You can `*\set*` a multiple authors by enumerating them in the preamble: |
| 184 |
|
| 185 |
[cols="a,a"] |
| 186 |
|=== |
| 187 |
|[source,latex] |
| 188 |
---- |
| 189 |
\documentclass{metanorma} |
| 190 |
\set{author_1}{Tom Sawyer} |
| 191 |
\set{author_2}{Dick Tracy} |
| 192 |
\set{author_3}{Harry Potter} |
| 193 |
\begin{document} |
| 194 |
Document authored by \get{author_1}, \get{author_2}, and \get{author_3}. |
| 195 |
\end{document} |
| 196 |
---- |
| 197 |
|[source,asciidoc] |
| 198 |
---- |
| 199 |
:author_1: Tom Sawyer |
| 200 |
:author_2: Dick Tracy |
| 201 |
:author_3: Harry Potter |
| 202 |
|
| 203 |
Document authored by {author_1}, {author_2}, and {author_3}. |
| 204 |
---- |
| 205 |
|=== |
| 206 |
|
| 207 |
:leveloffset!: |
| 208 |
|
| 209 |
== `*\mn*`: TODO |
| 210 |
|
| 211 |
:leveloffset: +1 |
| 212 |
|
| 213 |
= Sections |
| 214 |
|
| 215 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_headings.rb[test_headings.rb]. |
| 216 |
|
| 217 |
You can perform sectioning with the usual hierarchy of macros: `\section`, `\subsection`, `\subsubsection`, `\paragraph`, and `\subparagraph`: |
| 218 |
|
| 219 |
[cols="a,a"] |
| 220 |
|=== |
| 221 |
|[source,latex] |
| 222 |
---- |
| 223 |
\section{My section} |
| 224 |
|
| 225 |
\subsection{My subsection} |
| 226 |
|
| 227 |
\subsubsection{My subsubsection} |
| 228 |
|
| 229 |
\paragraph{My paragraph} |
| 230 |
|
| 231 |
\subparagraph{My subparagraph} |
| 232 |
---- |
| 233 |
|[source,asciidoc] |
| 234 |
---- |
| 235 |
== My section |
| 236 |
|
| 237 |
=== My subsection |
| 238 |
|
| 239 |
==== My subsubsection |
| 240 |
|
| 241 |
===== My paragraph |
| 242 |
|
| 243 |
====== My subparagraph |
| 244 |
---- |
| 245 |
|=== |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
== Fixed names |
| 251 |
|
| 252 |
Metanorma relies on (case insensitive) canonical names to recognize a few standard sections: |
| 253 |
|
| 254 |
* `Abstract` |
| 255 |
* `Introduction` |
| 256 |
* `Scope` |
| 257 |
* `Normative References` |
| 258 |
* `Terms and Definitions` |
| 259 |
* `Symbols and Abbreviations` |
| 260 |
* `Bibliography` |
| 261 |
|
| 262 |
NOTE: `Terms and Definitions` and `Symbols and Abbreviations` expect a fixed structure, explained in the respective sections of this manual. Conversely, the heading for `Bibliography` is tipically generated automatically. |
| 263 |
|
| 264 |
If you need to name these sections in a different way (e.g. in non-english documents), you can set the canonical name to be recognized by Metanorma as an attribute: |
| 265 |
|
| 266 |
[cols="a,a"] |
| 267 |
|=== |
| 268 |
|[source,latex] |
| 269 |
---- |
| 270 |
\section{Mõisted ja määratlused} |
| 271 |
\mn{heading=terms and definitions} |
| 272 |
---- |
| 273 |
|[source,asciidoc] |
| 274 |
---- |
| 275 |
[heading=terms and definitions] |
| 276 |
== Mõisted ja määratlused |
| 277 |
---- |
| 278 |
|=== |
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
== Foreword |
| 284 |
|
| 285 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_foreword.rb[test_foreword.rb]. |
| 286 |
|
| 287 |
Another special section is the foreword, which has the canonical name `Foreword` and should be used at the very beginning: |
| 288 |
|
| 289 |
[cols="a,a"] |
| 290 |
|=== |
| 291 |
|[source,latex] |
| 292 |
---- |
| 293 |
\section{Foreword} |
| 294 |
First paragraph of foreword. |
| 295 |
|
| 296 |
Second paragraph of foreword. |
| 297 |
---- |
| 298 |
|[source,asciidoc] |
| 299 |
---- |
| 300 |
[[Foreword]] |
| 301 |
.Foreword |
| 302 |
First paragraph of foreword. |
| 303 |
|
| 304 |
Second paragraph of foreword. |
| 305 |
---- |
| 306 |
|=== |
| 307 |
|
| 308 |
Just like the other standard sections, you can also pass the canonical name as an attribute: |
| 309 |
|
| 310 |
[cols="a,a"] |
| 311 |
|=== |
| 312 |
|[source,latex] |
| 313 |
---- |
| 314 |
\section{Prefazione} |
| 315 |
\mn{heading=foreword} |
| 316 |
Primo paragrafo della prefazione. |
| 317 |
|
| 318 |
Secondo paragrafo della prefazione. |
| 319 |
---- |
| 320 |
|[source,asciidoc] |
| 321 |
---- |
| 322 |
[[Foreword]] |
| 323 |
.Prefazione |
| 324 |
Primo paragrafo della prefazione. |
| 325 |
|
| 326 |
Secondo paragrafo della prefazione. |
| 327 |
---- |
| 328 |
|=== |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
== Blank headings |
| 334 |
|
| 335 |
To define a subclause which is numbered but bears no header text, you can use a blank name: |
| 336 |
|
| 337 |
|
| 338 |
[cols="a,a"] |
| 339 |
|=== |
| 340 |
|[source,latex] |
| 341 |
---- |
| 342 |
\subsection{} |
| 343 |
|
| 344 |
This subclause bears no title text. |
| 345 |
---- |
| 346 |
|[source,asciidoc] |
| 347 |
---- |
| 348 |
=== {blank} |
| 349 |
|
| 350 |
This subclause bears no title text. |
| 351 |
---- |
| 352 |
|=== |
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
== Deep levels |
| 358 |
|
| 359 |
Metanorma allows headings up to seven levels. |
| 360 |
`LaTeX` has only 5 macros, so we account for the two deepest levels by attaching a `*level*` attribute to `\subparagraph`: |
| 361 |
|
| 362 |
[cols="a,a"] |
| 363 |
|=== |
| 364 |
|[source,latex] |
| 365 |
---- |
| 366 |
\subparagraph{Heading at level 6} |
| 367 |
\mn{level=6} |
| 368 |
|
| 369 |
\subparagraph{Heading at level 7} |
| 370 |
\mn{level=7} |
| 371 |
---- |
| 372 |
|[source,asciidoc] |
| 373 |
---- |
| 374 |
[level=6] |
| 375 |
====== Heading at level 6 |
| 376 |
|
| 377 |
[level=7] |
| 378 |
====== Heading at level 7 |
| 379 |
---- |
| 380 |
|=== |
| 381 |
|
| 382 |
CAUTION: This feature has bad ergonomics and might change before the next major release. |
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
== Appendices |
| 388 |
|
| 389 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_appendix.rb[test_appendix.rb]. |
| 390 |
|
| 391 |
You can typeset appendices (i.e. annexes) by using the `\appendix` macro as it's customary in LaTeX. |
| 392 |
After you've called it all `\sections` will be treated as appendices. |
| 393 |
|
| 394 |
[cols="a,a"] |
| 395 |
|=== |
| 396 |
|[source,latex] |
| 397 |
---- |
| 398 |
\section{Ordinary section} |
| 399 |
|
| 400 |
Lorem ipsum. |
| 401 |
|
| 402 |
\appendix |
| 403 |
|
| 404 |
\section{My first appendix} |
| 405 |
|
| 406 |
Lorem ipsum. |
| 407 |
|
| 408 |
\section{Another appendix} |
| 409 |
|
| 410 |
Lorem ipsum. |
| 411 |
|
| 412 |
---- |
| 413 |
|[source,asciidoc] |
| 414 |
---- |
| 415 |
== The last ordinary section |
| 416 |
|
| 417 |
Lorem ipsum. |
| 418 |
|
| 419 |
[appendix] |
| 420 |
== My first appendix |
| 421 |
|
| 422 |
Lorem ipsum. |
| 423 |
|
| 424 |
[appendix] |
| 425 |
== Another appendix |
| 426 |
|
| 427 |
Lorem ipsum. |
| 428 |
---- |
| 429 |
|=== |
| 430 |
|
| 431 |
Just like other sections, you can pass attributes to appendices. E.g. to change the `obligation`: |
| 432 |
|
| 433 |
[cols="a,a"] |
| 434 |
|=== |
| 435 |
|[source,latex] |
| 436 |
---- |
| 437 |
\appendix |
| 438 |
\section{My appendix} |
| 439 |
\mn[obligation=informative] |
| 440 |
|
| 441 |
Lorem ipsum. |
| 442 |
---- |
| 443 |
|[source,asciidoc] |
| 444 |
---- |
| 445 |
[appendix,obligation=informative] |
| 446 |
== My appendix |
| 447 |
|
| 448 |
Lorem ipsum. |
| 449 |
---- |
| 450 |
|=== |
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
=== Inline headings |
| 456 |
|
| 457 |
You can typeset inline headings by passing `\%inline-header` as an attribute: |
| 458 |
|
| 459 |
[cols="a,a"] |
| 460 |
|=== |
| 461 |
|[source,latex] |
| 462 |
---- |
| 463 |
\subsection{Inline header,} |
| 464 |
\mn{\%inline-header} |
| 465 |
|
| 466 |
which begins this line. |
| 467 |
---- |
| 468 |
|[source,asciidoc] |
| 469 |
---- |
| 470 |
[%inline-header] |
| 471 |
=== Inline header, |
| 472 |
|
| 473 |
which begins this line. |
| 474 |
---- |
| 475 |
|=== |
| 476 |
|
| 477 |
CAUTION: This feature has bad ergonomics and might change before the next major release. |
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
== Language and script |
| 483 |
|
| 484 |
You can set the `language` and the `script` of a section using attributes: |
| 485 |
|
| 486 |
[cols="a,a"] |
| 487 |
|=== |
| 488 |
|[source,latex] |
| 489 |
---- |
| 490 |
\section{French section} |
| 491 |
\mn{language=fr} |
| 492 |
|
| 493 |
\section{Math section} |
| 494 |
\mn{script=Zmth} |
| 495 |
---- |
| 496 |
|[source,asciidoc] |
| 497 |
---- |
| 498 |
[language=fr] |
| 499 |
== French section |
| 500 |
|
| 501 |
[script=Zmth] |
| 502 |
== Math section |
| 503 |
---- |
| 504 |
|=== |
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
== Obligations |
| 510 |
|
| 511 |
You can set the `obligation` of a section (which can be either `informative` or `normative`) using an attribute: |
| 512 |
|
| 513 |
[cols="a,a"] |
| 514 |
|=== |
| 515 |
|[source,latex] |
| 516 |
---- |
| 517 |
\section{Informative section} |
| 518 |
\mn{obligation=informative} |
| 519 |
---- |
| 520 |
|[source,asciidoc] |
| 521 |
---- |
| 522 |
[obligation=informative] |
| 523 |
== Informative section |
| 524 |
---- |
| 525 |
|=== |
| 526 |
|
| 527 |
Note that most sections have a fixed default. |
| 528 |
Annexes and clauses default to `normative` but you can set them to `informative`. |
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
:leveloffset: +1 |
| 534 |
|
| 535 |
= Symbols and abbreviations |
| 536 |
|
| 537 |
`Symbols and Abbreviations` sections are expected to be simple <<_description_lists,description lists>>. |
| 538 |
|
| 539 |
Metanorma takes care of sorting the symbol entries in the order prescribed by ISO/IEC DIR 2, but it does not support sorting LaTeX math entries. |
| 540 |
Also note that the PDF rendered directly by LaTeX will not be sorted. |
| 541 |
|
| 542 |
:leveloffset!: |
| 543 |
:leveloffset: +1 |
| 544 |
|
| 545 |
= Terms and definitions |
| 546 |
|
| 547 |
`Terms and Definitions` subsections must be composed by these elements, in order: |
| 548 |
|
| 549 |
1. a heading of the appropriate level containing the term |
| 550 |
2. an optional `\label` to cross-reference the term from the others |
| 551 |
3. these optional macros, _whose parameter can contain markup_: |
| 552 |
`\alt`:: to specify alternative/admitted terms |
| 553 |
`\deprecated`:: to specify deprecated terms |
| 554 |
`\domain`:: to specify the term domain |
| 555 |
4. the term definition as a normal paragraph |
| 556 |
5. optional examples using the `*example*` environment |
| 557 |
6. optional notes using the `*note*` environment |
| 558 |
7. an optional citation using the `*source*` environment composed by a bibliographic reference followed by optional modification details |
| 559 |
|
| 560 |
Here is a full example: |
| 561 |
|
| 562 |
[cols="a,a"] |
| 563 |
|=== |
| 564 |
|[source,latex] |
| 565 |
---- |
| 566 |
\section{Terms and Definitions} |
| 567 |
|
| 568 |
\subsection{paddy} |
| 569 |
\label{paddy} |
| 570 |
\alt{paddy rice} |
| 571 |
\alt{rough \textbf{rice}} |
| 572 |
\deprecated{cargo rice} |
| 573 |
\domain{rice} |
| 574 |
|
| 575 |
rice retaining its husk after threshing |
| 576 |
|
| 577 |
\begin{example} |
| 578 |
Foreign seeds, husks, bran, sand, dust. |
| 579 |
\end{example} |
| 580 |
|
| 581 |
\begin{note} |
| 582 |
The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking. |
| 583 |
\end{note} |
| 584 |
|
| 585 |
\begin{source} |
| 586 |
\mncite[section 3.2]{ISO7301}, The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here |
| 587 |
\end{source} |
| 588 |
---- |
| 589 |
|[source,asciidoc] |
| 590 |
---- |
| 591 |
== Terms and Definitions |
| 592 |
|
| 593 |
[[paddy]] |
| 594 |
=== paddy |
| 595 |
alt:[paddy rice] |
| 596 |
alt:[rough **rice**] |
| 597 |
deprecated:[cargo rice] |
| 598 |
domain:[rice] |
| 599 |
|
| 600 |
rice retaining its husk after threshing |
| 601 |
|
| 602 |
[example] |
| 603 |
Foreign seeds, husks, bran, sand, dust. |
| 604 |
|
| 605 |
NOTE: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking. |
| 606 |
|
| 607 |
[.source] |
| 608 |
<<ISO7301,section 3.2>>, The term "cargo rice" is shown as deprecated, |
| 609 |
and Note 1 to entry is not included here |
| 610 |
---- |
| 611 |
|=== |
| 612 |
|
| 613 |
To treat a subsection of `Terms and Definitions` as a normal subsection instead of a term, e.g. an introductory section, you apply the `*.nonterm*` attribute to it as follows: |
| 614 |
|
| 615 |
[cols="a,a"] |
| 616 |
|=== |
| 617 |
|[source,latex] |
| 618 |
---- |
| 619 |
\section{Terms and definitions} |
| 620 |
|
| 621 |
\subsection{Introduction} |
| 622 |
\mn{.nonterm} |
| 623 |
|
| 624 |
The following terms have non-normative effect, and should be ignored by the ametrical. |
| 625 |
---- |
| 626 |
|[source,asciidoc] |
| 627 |
---- |
| 628 |
== Terms and definitions |
| 629 |
|
| 630 |
[.nonterm] |
| 631 |
=== Introduction |
| 632 |
The following terms have non-normative effect, and should be ignored by the ametrical. |
| 633 |
---- |
| 634 |
|=== |
| 635 |
|
| 636 |
:leveloffset!: |
| 637 |
|
| 638 |
:leveloffset!: |
| 639 |
|
| 640 |
:leveloffset: +1 |
| 641 |
|
| 642 |
= Text formatting |
| 643 |
|
| 644 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_text_formatting.rb[test_text_formatting.rb]. |
| 645 |
|
| 646 |
You can set bold, italic, monospace and small caps text using respectively `\textbf`, `\textit`, `\texttt` and `\textsc`. |
| 647 |
|
| 648 |
[cols="a,a"] |
| 649 |
|=== |
| 650 |
|[source,latex] |
| 651 |
---- |
| 652 |
\textbf{Bold} text. |
| 653 |
|
| 654 |
\textit{Italic} text. |
| 655 |
|
| 656 |
\texttt{Monospace} text. |
| 657 |
|
| 658 |
\textsc{Small caps} text. |
| 659 |
---- |
| 660 |
|[source,asciidoc] |
| 661 |
---- |
| 662 |
**Bold** text. |
| 663 |
|
| 664 |
__Italic__ text. |
| 665 |
|
| 666 |
``Monospace`` text. |
| 667 |
|
| 668 |
[smallcap]#Small caps# text. |
| 669 |
---- |
| 670 |
|=== |
| 671 |
|
| 672 |
The _switch_ versions of these macros are available too: `\bfseries`, `\itshape`, `\ttfamily` and `\scshape`. |
| 673 |
|
| 674 |
[cols="a,a"] |
| 675 |
|=== |
| 676 |
|[source,latex] |
| 677 |
---- |
| 678 |
{\bfseries Bold} text. |
| 679 |
|
| 680 |
{\itshape Italic} text. |
| 681 |
|
| 682 |
{\ttfamily Monospace} text. |
| 683 |
|
| 684 |
{\scshape Small caps} text. |
| 685 |
---- |
| 686 |
|[source,asciidoc] |
| 687 |
---- |
| 688 |
**Bold** text. |
| 689 |
|
| 690 |
__Italic__ text. |
| 691 |
|
| 692 |
``Monospace`` text. |
| 693 |
|
| 694 |
[smallcap]#Small caps# text. |
| 695 |
---- |
| 696 |
|=== |
| 697 |
|
| 698 |
You can set strikethrough, superscript and subscript text using respectively `*\textst*`, `\textsuperscript` and `\textsubscript`. |
| 699 |
|
| 700 |
[cols="a,a"] |
| 701 |
|=== |
| 702 |
|[source,latex] |
| 703 |
---- |
| 704 |
Strikethrough \textst{text}. |
| 705 |
|
| 706 |
Superscript \textsuperscript{text}. |
| 707 |
|
| 708 |
Subscript \textsubscript{text}. |
| 709 |
---- |
| 710 |
|[source,asciidoc] |
| 711 |
---- |
| 712 |
Strikethrough [strike]#text#. |
| 713 |
|
| 714 |
Superscript ^text^. |
| 715 |
|
| 716 |
Subscript ~text~. |
| 717 |
---- |
| 718 |
|=== |
| 719 |
|
| 720 |
NOTE: Strikethrough text is implemented using the {ctan-pkg-url}/ulem[ulem] package. |
| 721 |
|
| 722 |
:leveloffset!: |
| 723 |
:leveloffset: +1 |
| 724 |
|
| 725 |
= Paragraph alignment |
| 726 |
|
| 727 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_paragraph_alignment.rb[test_paragraph_alignment.rb]. |
| 728 |
|
| 729 |
You can set paragraph alignment explicitly using the `flushleft`, `center` and `flushright` environments. |
| 730 |
|
| 731 |
[cols="a,a"] |
| 732 |
|=== |
| 733 |
|[source,latex] |
| 734 |
---- |
| 735 |
\begin{flushleft} |
| 736 |
This paragraph is left aligned. |
| 737 |
\end{flushleft} |
| 738 |
---- |
| 739 |
|[source,asciidoc] |
| 740 |
---- |
| 741 |
[align=left] |
| 742 |
This paragraph is left aligned. |
| 743 |
---- |
| 744 |
|=== |
| 745 |
|
| 746 |
[cols="a,a"] |
| 747 |
|=== |
| 748 |
|[source,latex] |
| 749 |
---- |
| 750 |
\begin{center} |
| 751 |
This paragraph is centered. |
| 752 |
\end{center} |
| 753 |
---- |
| 754 |
|[source,asciidoc] |
| 755 |
---- |
| 756 |
[align=center] |
| 757 |
This paragraph is centered. |
| 758 |
---- |
| 759 |
|=== |
| 760 |
|
| 761 |
[cols="a,a"] |
| 762 |
|=== |
| 763 |
|[source,latex] |
| 764 |
---- |
| 765 |
\begin{flushright} |
| 766 |
This paragraph is right aligned. |
| 767 |
\end{flushright} |
| 768 |
---- |
| 769 |
|[source,asciidoc] |
| 770 |
---- |
| 771 |
[align=right] |
| 772 |
This paragraph is right aligned. |
| 773 |
---- |
| 774 |
|=== |
| 775 |
|
| 776 |
The default alignment is _justified_, so no environment is provided for that. |
| 777 |
|
| 778 |
:leveloffset!: |
| 779 |
:leveloffset: +1 |
| 780 |
|
| 781 |
= Cross-references (aka internal references) |
| 782 |
|
| 783 |
[NOTE] |
| 784 |
==== |
| 785 |
These features are verified by tests in {repo-blob-url}/test/test_cross_references.rb[test_cross_references.rb]. |
| 786 |
==== |
| 787 |
|
| 788 |
To reference some part of the document you must first of all label it using `\label`. |
| 789 |
Many parts of the document accept labels (headings, tables, list items, etc.) and you will find an example in the related section when that's the case. |
| 790 |
|
| 791 |
For the sake of the next examples, let's assume a section labeled `sec:foo` exists. |
| 792 |
|
| 793 |
You can reference `sec:foo` by using the `\ref` macro: |
| 794 |
|
| 795 |
[cols="a,a"] |
| 796 |
|=== |
| 797 |
|[source,latex] |
| 798 |
Go look at \ref{sec:foo}. |
| 799 |
|[source,asciidoc] |
| 800 |
Go look at <<sec:foo>>. |
| 801 |
|=== |
| 802 |
|
| 803 |
To reference `sec:foo` with a custom text you can use the `\hyperref` macro: |
| 804 |
|
| 805 |
[cols="a,a"] |
| 806 |
|=== |
| 807 |
|[source,latex] |
| 808 |
Go look at \hyperref[sec:foo]{this}. |
| 809 |
|[source,asciidoc] |
| 810 |
Go look at <<sec:foo, this>>. |
| 811 |
|=== |
| 812 |
|
| 813 |
:leveloffset!: |
| 814 |
:leveloffset: +1 |
| 815 |
|
| 816 |
= Links (aka external references) |
| 817 |
|
| 818 |
[NOTE] |
| 819 |
==== |
| 820 |
These features are verified by tests in {repo-blob-url}/test/test_links.rb[test_links.rb]. |
| 821 |
==== |
| 822 |
|
| 823 |
References can also point to URLs identifying resources external to the document. |
| 824 |
|
| 825 |
You can link to a website by using the `\url` macro: |
| 826 |
|
| 827 |
[cols="a,a"] |
| 828 |
|=== |
| 829 |
|[source,latex] |
| 830 |
Go look at \url{https://www.metanorma.com/}. |
| 831 |
|[source,asciidoc] |
| 832 |
Go look at link:++https://www.metanorma.com/++[]. |
| 833 |
|=== |
| 834 |
|
| 835 |
To link to a website with a custom text you can use the `\href` macro: |
| 836 |
|
| 837 |
[cols="a,a"] |
| 838 |
|=== |
| 839 |
|[source,latex] |
| 840 |
Go look at \href{https://www.metanorma.com/}{Metanorma home}. |
| 841 |
|[source,asciidoc] |
| 842 |
Go look at link:++https://www.metanorma.com/++[Metanorma home]. |
| 843 |
|=== |
| 844 |
|
| 845 |
:leveloffset!: |
| 846 |
|
| 847 |
== Bibliography and citations |
| 848 |
:leveloffset: +2 |
| 849 |
|
| 850 |
= Bibliography |
| 851 |
|
| 852 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_bibliography.rb[test_bibliography.rb]. |
| 853 |
|
| 854 |
You can cite a bibliographic source using the `\cite` macro as usual. |
| 855 |
|
| 856 |
CAUTION: Multiple citations, e.g. `\cite{KEY1,KEY2}` are not supported. |
| 857 |
|
| 858 |
The bibliographic database can be specified in two different ways. |
| 859 |
|
| 860 |
If the bibliography is small or you want to typeset each entry manually you can use the `thebibliography` environment to wrap a list of bibliographic items described by `\bibitem`. |
| 861 |
|
| 862 |
[cols="a,a"] |
| 863 |
|=== |
| 864 |
|[source,latex] |
| 865 |
---- |
| 866 |
\documentclass{metanorma} |
| 867 |
|
| 868 |
\begin{document} |
| 869 |
|
| 870 |
This document cites \cite{ISO7301}. |
| 871 |
It also cites \cite{einstein}. |
| 872 |
|
| 873 |
\begin{thebibliography}{2} |
| 874 |
\bibitem[ISO 7301]{ISO7301} |
| 875 |
Rice -- Specification |
| 876 |
|
| 877 |
\bibitem{einstein} |
| 878 |
Albert Einstein. |
| 879 |
\textit{Zur Elektrodynamik bewegter K{\"o}rper}. (German) |
| 880 |
[\textit{On the electrodynamics of moving bodies}]. |
| 881 |
Annalen der Physik, 322(10):891–921, 1905. |
| 882 |
\end{thebibliography} |
| 883 |
\end{document} |
| 884 |
---- |
| 885 |
| |
| 886 |
[source,asciidoc] |
| 887 |
---- |
| 888 |
This document cites <<ISO7301>>. |
| 889 |
It also cites <<einstein>>. |
| 890 |
|
| 891 |
[bibliography] |
| 892 |
== References |
| 893 |
|
| 894 |
* [[[ISO7301,ISO 7301]]] |
| 895 |
Rice – Specification |
| 896 |
|
| 897 |
* [[[einstein,2]]] |
| 898 |
Albert Einstein. |
| 899 |
__Zur Elektrodynamik bewegter Körper__. (German) |
| 900 |
[__On the electrodynamics of moving bodies__]. |
| 901 |
Annalen der Physik, 322(10):891–921, 1905. |
| 902 |
---- |
| 903 |
|=== |
| 904 |
|
| 905 |
If the bibliography is big or you have an existing BibTeX database, you can use that too by passing the filename to the `\bibliography` macro. |
| 906 |
|
| 907 |
[cols="a,a"] |
| 908 |
|=== |
| 909 |
|[source,latex] |
| 910 |
---- |
| 911 |
\documentclass{metanorma} |
| 912 |
|
| 913 |
\begin{document} |
| 914 |
Everyone should read \cite{einstein}. |
| 915 |
Many interesting books are found in \cite{knuthwebsite}. |
| 916 |
|
| 917 |
\bibliography{my_database.bib} |
| 918 |
\end{document} |
| 919 |
---- |
| 920 |
.Contents of `my_database.bib` |
| 921 |
[source,bibtex] |
| 922 |
---- |
| 923 |
@article{einstein, |
| 924 |
author = "Albert Einstein", |
| 925 |
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German}) |
| 926 |
[{On} lectrodynamics of moving bodies]", |
| 927 |
journal = "Annalen der Physik", |
| 928 |
volume = "322", |
| 929 |
number = "10", |
| 930 |
pages = "891--921", |
| 931 |
year = "1905", |
| 932 |
DOI = "http://dx.doi.org/10.1002/andp.19053221004" |
| 933 |
} |
| 934 |
|
| 935 |
@misc{knuthwebsite, |
| 936 |
author = "Donald Knuth", |
| 937 |
title = "Knuth: Computers and Typesetting", |
| 938 |
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html" |
| 939 |
} |
| 940 |
---- |
| 941 |
| |
| 942 |
[source,asciidoc] |
| 943 |
---- |
| 944 |
Everyone should read <<einstein>>. |
| 945 |
Many interesting books are found in <<knuthwebsite>>. |
| 946 |
|
| 947 |
[bibliography] |
| 948 |
== References |
| 949 |
|
| 950 |
* [[[einstein,1]]] |
| 951 |
{blank}A. Einstein (1905) |
| 952 |
Zur Elektrodynamik bewegter Körper. (German) [On the electrodynamics of moving bodies]. |
| 953 |
Annalen der Physik322 (10), pp. 891–921. |
| 954 |
External Links: http://dx.doi.org/10.1002/andp.19053221004[Document] |
| 955 |
|
| 956 |
* [[[knuthwebsite,3]]] |
| 957 |
{blank}D. Knuth |
| 958 |
Knuth: computers and typesetting. |
| 959 |
External Links: http://www-cs-faculty.stanford.edu/\~uno/abcde.html[Link] |
| 960 |
---- |
| 961 |
|=== |
| 962 |
|
| 963 |
CAUTION: While you can use bibliographic styles on the `LaTeX` side and |
| 964 |
https://www.relaton.com/[Relaton] databases on the `Adoc` side, |
| 965 |
these features are still not supported on the opposing side. |
| 966 |
|
| 967 |
:leveloffset!: |
| 968 |
:leveloffset: +2 |
| 969 |
|
| 970 |
= Advanced citations |
| 971 |
|
| 972 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_mncite.rb[test_mncite.rb]. |
| 973 |
|
| 974 |
To leverage the full power of Metanorma you can use `*\mncite*` to typeset bibliographic references. |
| 975 |
|
| 976 |
`*\mncite*` accepts three arguments as `\mncite[<1>]{<2>}[<3>]`: |
| 977 |
|
| 978 |
1. the first argument (optional) is the citation which will be rendered literally; |
| 979 |
2. the second argument (mandatory) is the bibliographic key; |
| 980 |
3. the third argument (optional) is a list of https://www.metanorma.com/author/topics/document-format/bibliography/#localities[localities]. |
| 981 |
|
| 982 |
[cols="a,a"] |
| 983 |
|=== |
| 984 |
|[source,latex] |
| 985 |
---- |
| 986 |
\mncite{ISO712} |
| 987 |
|
| 988 |
\mncite[the foregoing reference]{ISO712} |
| 989 |
|
| 990 |
\mncite{ISO712}[section=5,page=8-10] |
| 991 |
|
| 992 |
\mncite[5:8-10]{ISO712}[section=5,page=8-10] |
| 993 |
---- |
| 994 |
| |
| 995 |
[source,asciidoc] |
| 996 |
---- |
| 997 |
<<ISO712>> |
| 998 |
|
| 999 |
<<ISO712,the foregoing reference>> |
| 1000 |
|
| 1001 |
<<ISO712,section=5,page=8-10>> |
| 1002 |
|
| 1003 |
<<ISO712,section=5,page=8-10,5:8-10>> |
| 1004 |
---- |
| 1005 |
|=== |
| 1006 |
|
| 1007 |
|
| 1008 |
CAUTION: Multiple citations, e.g. `\cite{KEY1,KEY2}` are not supported. |
| 1009 |
|
| 1010 |
CAUTION: Localities are not rendered by the LaTeX class yet, only by Metanorma compilation. |
| 1011 |
|
| 1012 |
:leveloffset!: |
| 1013 |
|
| 1014 |
:leveloffset: +1 |
| 1015 |
|
| 1016 |
= Block quotations |
| 1017 |
|
| 1018 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_block_quotations.rb[test_block_quotations.rb]. |
| 1019 |
|
| 1020 |
You can typeset block quotations using the `quote` environment: |
| 1021 |
|
| 1022 |
[cols="a,a"] |
| 1023 |
|=== |
| 1024 |
|[source,latex] |
| 1025 |
---- |
| 1026 |
\begin{quote} |
| 1027 |
This is a block quotation. |
| 1028 |
\end{quote} |
| 1029 |
---- |
| 1030 |
| |
| 1031 |
[source,asciidoc] |
| 1032 |
---- |
| 1033 |
[quote] |
| 1034 |
____ |
| 1035 |
This is a block quotation. |
| 1036 |
____ |
| 1037 |
---- |
| 1038 |
|=== |
| 1039 |
|
| 1040 |
The attribution and the citation title can be passed through to AsciiDoc by using the `*\mn*` macro: |
| 1041 |
|
| 1042 |
[cols="a,a"] |
| 1043 |
|=== |
| 1044 |
|[source,latex] |
| 1045 |
---- |
| 1046 |
\begin{quote} |
| 1047 |
\mn{ISO,"ISO7301, section 1"} |
| 1048 |
This is a block quotation. |
| 1049 |
\end{quote} |
| 1050 |
---- |
| 1051 |
| |
| 1052 |
[source,asciidoc] |
| 1053 |
---- |
| 1054 |
[quote,ISO,"ISO7301, section 1"] |
| 1055 |
____ |
| 1056 |
This is a block quotation. |
| 1057 |
____ |
| 1058 |
---- |
| 1059 |
|=== |
| 1060 |
|
| 1061 |
CAUTION: This feature is not complete; attribution and citation title are currently not rendered by `LaTeX`. |
| 1062 |
|
| 1063 |
:leveloffset!: |
| 1064 |
:leveloffset: +1 |
| 1065 |
|
| 1066 |
= Lists |
| 1067 |
|
| 1068 |
All usual typologies of lists available in `LaTeX` can be used; |
| 1069 |
as usual, they work by listing items usinf the `\item` macro inside a specific environment. |
| 1070 |
|
| 1071 |
== Ordered lists |
| 1072 |
|
| 1073 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_ordered_lists.rb[test_ordered_lists.rb]. |
| 1074 |
|
| 1075 |
You can typeset ordered lists using the `enumerate` environment: |
| 1076 |
|
| 1077 |
[cols="a,a"] |
| 1078 |
|=== |
| 1079 |
|[source,latex] |
| 1080 |
\begin{enumerate} |
| 1081 |
\item Hey, |
| 1082 |
\item ho, |
| 1083 |
\item let's go! |
| 1084 |
\end{enumerate} |
| 1085 |
|[source,asciidoc] |
| 1086 |
. Hey, |
| 1087 |
. ho, |
| 1088 |
. let’s go! |
| 1089 |
|=== |
| 1090 |
|
| 1091 |
== Unordered lists |
| 1092 |
|
| 1093 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_unordered_lists.rb[test_unordered_lists.rb]. |
| 1094 |
|
| 1095 |
You can typeset unordered lists using the `itemize` environment: |
| 1096 |
|
| 1097 |
[cols="a,a"] |
| 1098 |
|=== |
| 1099 |
|[source,latex] |
| 1100 |
\begin{itemize} |
| 1101 |
\item Foo |
| 1102 |
\item Bar |
| 1103 |
\item Baz |
| 1104 |
\end{itemize} |
| 1105 |
|[source,asciidoc] |
| 1106 |
* Foo |
| 1107 |
* Bar |
| 1108 |
* Baz |
| 1109 |
|=== |
| 1110 |
|
| 1111 |
== Description lists |
| 1112 |
|
| 1113 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_description_lists.rb[test_description_lists.rb]. |
| 1114 |
|
| 1115 |
You can typeset description lists using the `description` environment: |
| 1116 |
|
| 1117 |
[cols="a,a"] |
| 1118 |
|=== |
| 1119 |
|[source,latex] |
| 1120 |
\begin{description} |
| 1121 |
\item[Lee] bass guitar and lead vocals |
| 1122 |
\item[Lifeson] guitars and backing vocals |
| 1123 |
\item[Peart] drums and percussion |
| 1124 |
\end{description} |
| 1125 |
|[source,asciidoc] |
| 1126 |
Lee:: bass guitar and lead vocals |
| 1127 |
Lifeson:: guitars and backing vocals |
| 1128 |
Peart:: drums and percussion |
| 1129 |
|=== |
| 1130 |
|
| 1131 |
|
| 1132 |
|
| 1133 |
|
| 1134 |
== Nested lists |
| 1135 |
|
| 1136 |
NOTE: These features are verified by tests in {repo-blob-url}/test/test_stressed_lists.rb[test_stressed_lists.rb]. |
| 1137 |
|
| 1138 |
You can nest ordered, unordered and description lists freely. |
| 1139 |
|
| 1140 |
CAUTION: While `AsciiDoc` has no depth limit, `LaTeX` is limited to a depth of 4. |
| 1141 |
|
| 1142 |
|
| 1143 |
|
| 1144 |
|
| 1145 |
// TODO: == Long items and paragraph breaks |
| 1146 |
|
| 1147 |
:leveloffset!: |
| 1148 |
:leveloffset: +1 |
| 1149 |
|
| 1150 |
= Math |
| 1151 |
|
| 1152 |
[NOTE] |
| 1153 |
==== |
| 1154 |
These features are verified by tests in |
| 1155 |
{repo-blob-url}/test/test_math_inline.rb[test_math_inline.rb] and |
| 1156 |
{repo-blob-url}/test/test_math_display.rb[test_math_display.rb]. |
| 1157 |
==== |
| 1158 |
|
| 1159 |
You can typeset inline math delimiting it with `S`/`$` pairs: |
| 1160 |
|
| 1161 |
[cols="a,a"] |
| 1162 |
|=== |
| 1163 |
|[source,latex] |
| 1164 |
Euler's identity is $e^{i\pi}+1=0$. |
| 1165 |
|[source,asciidoc] |
| 1166 |
Euler's identity is stem:[e^{i\pi}+1=0]. |
| 1167 |
|=== |
| 1168 |
|
| 1169 |
You can typeset display math delimiting it with `\[`/`\]` pairs: |
| 1170 |
|
| 1171 |
[cols="a,a"] |
| 1172 |
|=== |
| 1173 |
|[source,latex] |
| 1174 |
Here is the Binomial Theorem: |
| 1175 |
\[(1+x)^n = \sum_{k=0}^n {n \choose k}x^k\] |
| 1176 |
|[source,asciidoc] |
| 1177 |
---- |
| 1178 |
Here is the Binomial Theorem: |
| 1179 |
|
| 1180 |
[stem] |
| 1181 |
++++ |
| 1182 |
(1+x)^n = \sum_{k=0}^n {n \choose k}x^k |
| 1183 |
++++ |
| 1184 |
---- |
| 1185 |
|=== |
| 1186 |
|
| 1187 |
// TODO: Whould we make it explicit about `:stem: latexmath`? |
| 1188 |
// TODO: == Math environments |
| 1189 |
// TODO: == Formulae, see https://www.metanorma.com/author/topics/document-format/text/#formulae |
| 1190 |
|
| 1191 |
:leveloffset!: |
| 1192 |
:leveloffset: +1 |
| 1193 |
|
| 1194 |
= Tables |
| 1195 |
|
| 1196 |
[NOTE] |
| 1197 |
==== |
| 1198 |
These features are verified by tests in {repo-blob-url}/test/test_tables.rb[test_tables.rb]. |
| 1199 |
==== |
| 1200 |
|
| 1201 |
You can typeset simple tables using the `tabular` environment: |
| 1202 |
|
| 1203 |
[cols="a,a",separator=!] |
| 1204 |
!=== |
| 1205 |
![source,latex] |
| 1206 |
\begin{tabular}{ll} |
| 1207 |
A & B \\ |
| 1208 |
C & D \\ |
| 1209 |
\end{tabular} |
| 1210 |
![source,asciidoc] |
| 1211 |
---- |
| 1212 |
[cols=2*] |
| 1213 |
|=== |
| 1214 |
| A |
| 1215 |
| B |
| 1216 |
|
| 1217 |
| C |
| 1218 |
| D |
| 1219 |
|=== |
| 1220 |
---- |
| 1221 |
!=== |
| 1222 |
|
| 1223 |
You can add labels and captions by wrapping a `tabular` with the `table` environment and using the `\label` and `\caption` macros: |
| 1224 |
|
| 1225 |
[cols="a,a",separator=!] |
| 1226 |
!=== |
| 1227 |
![source,latex] |
| 1228 |
\begin{table} |
| 1229 |
\label{tab:example} |
| 1230 |
\caption{This is the caption} |
| 1231 |
\begin{tabular}{ll} |
| 1232 |
A & B \\ |
| 1233 |
C & D \\ |
| 1234 |
\end{tabular} |
| 1235 |
\end{table} |
| 1236 |
![source,asciidoc] |
| 1237 |
---- |
| 1238 |
[[tab:example]] |
| 1239 |
.This is the caption |
| 1240 |
[cols=2*] |
| 1241 |
|=== |
| 1242 |
| A |
| 1243 |
| B |
| 1244 |
|
| 1245 |
| C |
| 1246 |
| D |
| 1247 |
|=== |
| 1248 |
---- |
| 1249 |
!=== |
| 1250 |
|
| 1251 |
:leveloffset!: |
| 1252 |
:leveloffset: +1 |
| 1253 |
|
| 1254 |
= Figures |
| 1255 |
|
| 1256 |
[NOTE] |
| 1257 |
==== |
| 1258 |
These features are verified by tests in {repo-blob-url}/test/test_figures.rb[test_figures.rb]. |
| 1259 |
==== |
| 1260 |
|
| 1261 |
You can typeset figures by using the `figure` environment. |
| 1262 |
|
| 1263 |
Use `\includegraphics` to include an image. |
| 1264 |
|
| 1265 |
Use `\label` and `\caption` to add labels and captions to figures. |
| 1266 |
|
| 1267 |
[cols="a,a"] |
| 1268 |
|=== |
| 1269 |
|[source,latex] |
| 1270 |
\begin{figure} |
| 1271 |
\label{fig:example} |
| 1272 |
\caption{This is the caption} |
| 1273 |
\includegraphics{example.jpg} |
| 1274 |
\end{figure} |
| 1275 |
|[source,asciidoc] |
| 1276 |
---- |
| 1277 |
[[fig:example]] |
| 1278 |
.This is the caption |
| 1279 |
image::example.jpg[] |
| 1280 |
---- |
| 1281 |
|=== |
| 1282 |
|
| 1283 |
|
| 1284 |
|
| 1285 |
|
| 1286 |
== Subfigures |
| 1287 |
|
| 1288 |
[NOTE] |
| 1289 |
==== |
| 1290 |
These features are verified by tests in {repo-blob-url}/test/test_subfigures.rb[test_subfigures.rb]. |
| 1291 |
==== |
| 1292 |
|
| 1293 |
To typeset a figure containing subfigures you can nest the `subfigure` environment inside a `figure`. |
| 1294 |
|
| 1295 |
The macros `\caption` and `\label` work as you would expect inside subfigures too. |
| 1296 |
|
| 1297 |
[cols="a,a"] |
| 1298 |
|=== |
| 1299 |
|[source,latex] |
| 1300 |
\begin{figure}\centering |
| 1301 |
\begin{subfigure}[b]{0.4\textwidth} |
| 1302 |
\includegraphics[width=\textwidth]{left.jpg} |
| 1303 |
\caption{A subfigure on the left} |
| 1304 |
\label{fig:left} |
| 1305 |
\end{subfigure} |
| 1306 |
\qquad |
| 1307 |
\begin{subfigure}[b]{0.4\textwidth} |
| 1308 |
\includegraphics[width=\textwidth]{right.jpg} |
| 1309 |
\caption{A subfigure on the right} |
| 1310 |
\label{fig:right} |
| 1311 |
\end{subfigure} |
| 1312 |
\caption{A figure with two subfigures} |
| 1313 |
\label{fig:whole} |
| 1314 |
\end{figure} |
| 1315 |
|[source,asciidoc] |
| 1316 |
---- |
| 1317 |
[[fig:whole]] |
| 1318 |
.A figure with two subfigures |
| 1319 |
==== |
| 1320 |
[[fig:left]] |
| 1321 |
.A subfigure on the left |
| 1322 |
image::left.jpg[] |
| 1323 |
|
| 1324 |
[[fig:right]] |
| 1325 |
.A subfigure on the right |
| 1326 |
image::right.jpg[] |
| 1327 |
|
| 1328 |
==== |
| 1329 |
---- |
| 1330 |
|=== |
| 1331 |
|
| 1332 |
NOTE: Subfigures are implemented using the {ctan-pkg-url}/subcaption[subcaption] package. |
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
|
| 1337 |
== Keys |
| 1338 |
|
| 1339 |
[NOTE] |
| 1340 |
==== |
| 1341 |
These features are verified by tests in {repo-blob-url}/test/test_figures_key.rb[test_figures_key.rb]. |
| 1342 |
==== |
| 1343 |
|
| 1344 |
|
| 1345 |
To typeset the key for a figure you can use a `*key*` environment (which behaves like a `description`) inside a `\paragraph` titled `Key`. |
| 1346 |
|
| 1347 |
[cols="a,a"] |
| 1348 |
|=== |
| 1349 |
|[source,latex] |
| 1350 |
\begin{figure} |
| 1351 |
\includegraphics{example.jpg} |
| 1352 |
\label{fig:example} |
| 1353 |
\caption{This is the caption} |
| 1354 |
\paragraph*{Key} |
| 1355 |
\begin{key} |
| 1356 |
\item[A] First letter |
| 1357 |
\item[B] Second letter |
| 1358 |
\item[C] Third letter |
| 1359 |
\end{key} |
| 1360 |
\end{figure} |
| 1361 |
|[source,asciidoc] |
| 1362 |
---- |
| 1363 |
[[fig:example]] |
| 1364 |
.This is the caption |
| 1365 |
image::example.jpg[] |
| 1366 |
|
| 1367 |
*Key* |
| 1368 |
|
| 1369 |
A:: |
| 1370 |
First letter |
| 1371 |
B:: |
| 1372 |
Second letter |
| 1373 |
C:: |
| 1374 |
Third letter |
| 1375 |
---- |
| 1376 |
|=== |
| 1377 |
|
| 1378 |
NOTE: Figures keys are implemented using the {ctan-pkg-url}/enumitem[enumitem] package. |
| 1379 |
|
| 1380 |
:leveloffset!: |
| 1381 |
:leveloffset: +1 |
| 1382 |
|
| 1383 |
= Footnotes |
| 1384 |
|
| 1385 |
[NOTE] |
| 1386 |
==== |
| 1387 |
These features are verified by tests in {repo-blob-url}/test/test_footnotes.rb[test_footnotes.rb]. |
| 1388 |
==== |
| 1389 |
|
| 1390 |
You can typeset footnotes by using `\footnote`: |
| 1391 |
|
| 1392 |
[cols="a,a"] |
| 1393 |
|=== |
| 1394 |
|[source,latex] |
| 1395 |
Footnotes are useful\footnote{Unless abused.}. |
| 1396 |
|[source,asciidoc] |
| 1397 |
Footnotes are useful footnote:[Unless abused.]. |
| 1398 |
|=== |
| 1399 |
|
| 1400 |
// TODO: === Footnotes in tables |
| 1401 |
// TODO: === Footnotes in figures |
| 1402 |
|
| 1403 |
:leveloffset!: |
| 1404 |
:leveloffset: +1 |
| 1405 |
|
| 1406 |
= Requirements, Recommendations, and Permissions |
| 1407 |
|
| 1408 |
[NOTE] |
| 1409 |
==== |
| 1410 |
These features are verified by tests in {repo-blob-url}/test/test_blocks.rb[test_blocks.rb]. |
| 1411 |
==== |
| 1412 |
|
| 1413 |
You can typeset requirements, recommendations, and permissions by using the homonymous environments `*requirement*`, `*recommendation*` and `*permission*`: |
| 1414 |
|
| 1415 |
[cols="a,a"] |
| 1416 |
|=== |
| 1417 |
|[source,latex] |
| 1418 |
\begin{requirement} |
| 1419 |
This is a requirement block. |
| 1420 |
\end{requirement} |
| 1421 |
|[source,asciidoc] |
| 1422 |
---- |
| 1423 |
[.requirement] |
| 1424 |
==== |
| 1425 |
This is a requirement block. |
| 1426 |
==== |
| 1427 |
---- |
| 1428 |
|=== |
| 1429 |
|
| 1430 |
[cols="a,a"] |
| 1431 |
|=== |
| 1432 |
|[source,latex] |
| 1433 |
\begin{recommendation} |
| 1434 |
This is a recommendation block. |
| 1435 |
\end{recommendation} |
| 1436 |
|[source,asciidoc] |
| 1437 |
---- |
| 1438 |
[.recommendation] |
| 1439 |
==== |
| 1440 |
This is a recommendation block. |
| 1441 |
==== |
| 1442 |
---- |
| 1443 |
|=== |
| 1444 |
|
| 1445 |
[cols="a,a"] |
| 1446 |
|=== |
| 1447 |
|[source,latex] |
| 1448 |
\begin{permission} |
| 1449 |
This is a permission block. |
| 1450 |
\end{permission} |
| 1451 |
|[source,asciidoc] |
| 1452 |
---- |
| 1453 |
[.permission] |
| 1454 |
==== |
| 1455 |
This is a permission block. |
| 1456 |
==== |
| 1457 |
---- |
| 1458 |
|=== |
| 1459 |
|
| 1460 |
== Attributes |
| 1461 |
|
| 1462 |
CAUTION: TODO |
| 1463 |
|
| 1464 |
== Nesting |
| 1465 |
|
| 1466 |
Requirements, recommendations and permissions can be nested: |
| 1467 |
|
| 1468 |
[cols="a,a"] |
| 1469 |
|=== |
| 1470 |
|[source,latex] |
| 1471 |
---- |
| 1472 |
\begin{requirement} |
| 1473 |
Here is a nested requirement. |
| 1474 |
|
| 1475 |
\begin{requirement} |
| 1476 |
First nested requirement. |
| 1477 |
\end{requirement} |
| 1478 |
|
| 1479 |
Here is another nested requirement. |
| 1480 |
|
| 1481 |
\begin{requirement} |
| 1482 |
Second nested requirement. |
| 1483 |
\end{requirement} |
| 1484 |
\end{requirement} |
| 1485 |
---- |
| 1486 |
|[source,asciidoc] |
| 1487 |
---- |
| 1488 |
[.requirement] |
| 1489 |
==== |
| 1490 |
Here is a nested requirement. |
| 1491 |
|
| 1492 |
[.requirement] |
| 1493 |
===== |
| 1494 |
First nested requirement. |
| 1495 |
===== |
| 1496 |
|
| 1497 |
Here is another nested requirement. |
| 1498 |
|
| 1499 |
[.requirement] |
| 1500 |
====== |
| 1501 |
Second nested requirement. |
| 1502 |
====== |
| 1503 |
==== |
| 1504 |
---- |
| 1505 |
|=== |
| 1506 |
|
| 1507 |
== Internal structure |
| 1508 |
|
| 1509 |
The internal structure of requirements, recommendations and permissions can be further marked up with environments which will help making the document machine-readable. Such environments are: `*specification*`, `*measurement-target*`, `*verification*`, and `*import*`. |
| 1510 |
|
| 1511 |
[cols="a,a"] |
| 1512 |
|=== |
| 1513 |
|[source,latex] |
| 1514 |
---- |
| 1515 |
\begin{requirement} |
| 1516 |
This is descriptive text. |
| 1517 |
|
| 1518 |
\begin{specification} |
| 1519 |
This is a formal statement, which may be considered the object of the requirement. |
| 1520 |
\end{specification} |
| 1521 |
|
| 1522 |
\begin{measurement-target} |
| 1523 |
This is a quantitative measure for the requirement. |
| 1524 |
\end{measurement-target} |
| 1525 |
|
| 1526 |
\begin{verification} |
| 1527 |
This is a verification step for the requirement |
| 1528 |
\end{verification} |
| 1529 |
|
| 1530 |
\begin{import} |
| 1531 |
This is a code stub. |
| 1532 |
\end{import} |
| 1533 |
\end{requirement} |
| 1534 |
---- |
| 1535 |
|[source,asciidoc] |
| 1536 |
---- |
| 1537 |
[.requirement] |
| 1538 |
==== |
| 1539 |
This is descriptive text. |
| 1540 |
|
| 1541 |
[.specification] |
| 1542 |
-- |
| 1543 |
This is a formal statement, which may be considered the object of the requirement. |
| 1544 |
-- |
| 1545 |
|
| 1546 |
[.measurement-target] |
| 1547 |
-- |
| 1548 |
This is a quantitative measure for the requirement. |
| 1549 |
-- |
| 1550 |
|
| 1551 |
[.verification] |
| 1552 |
-- |
| 1553 |
This is a verification step for the requirement |
| 1554 |
-- |
| 1555 |
|
| 1556 |
[.import] |
| 1557 |
-- |
| 1558 |
This is a code stub. |
| 1559 |
-- |
| 1560 |
==== |
| 1561 |
---- |
| 1562 |
|=== |
| 1563 |
|
| 1564 |
:leveloffset!: |
| 1565 |
:leveloffset: +1 |
| 1566 |
|
| 1567 |
= Reviewer notes |
| 1568 |
|
| 1569 |
[NOTE] |
| 1570 |
==== |
| 1571 |
These features are verified by tests in {repo-blob-url}/test/test_reviewer_notes.rb[test_reviewer_notes.rb]. |
| 1572 |
==== |
| 1573 |
|
| 1574 |
You can typeset reviewer notes by using the `*reviewernotes*` environment. |
| 1575 |
|
| 1576 |
By using `*\mn*` at the beginning of the environment you can set the following attributes: |
| 1577 |
|
| 1578 |
`reviewer` (_mandatory_):: |
| 1579 |
Name of the reviewer |
| 1580 |
`from` (_mandatory_):: |
| 1581 |
Starting target anchor |
| 1582 |
`to` (_optional_):: |
| 1583 |
Ending target anchor |
| 1584 |
`date` (_optional_):: |
| 1585 |
Date attribute (optionally including time) |
| 1586 |
|
| 1587 |
Here is a full example: |
| 1588 |
|
| 1589 |
[cols="a,a"] |
| 1590 |
|=== |
| 1591 |
|[source,latex] |
| 1592 |
\begin{reviewernote} |
| 1593 |
\mn{reviewer="John Doe",date=20180125T0121,from=A,to=B} |
| 1594 |
Lorem ipsum. |
| 1595 |
\end{reviewernote} |
| 1596 |
|[source,asciidoc] |
| 1597 |
---- |
| 1598 |
[reviewer="John Doe",date=20180125T0121,from=A,to=B] |
| 1599 |
**** |
| 1600 |
Lorem ipsum. |
| 1601 |
**** |
| 1602 |
---- |
| 1603 |
|=== |
| 1604 |
|
| 1605 |
CAUTION: The `reviewer` and `date` attributes are currently not rendered by LaTeX but only passed to Adoc. |
| 1606 |
|
| 1607 |
:leveloffset!: |
| 1608 |
:leveloffset: +1 |
| 1609 |
|
| 1610 |
= Todos |
| 1611 |
|
| 1612 |
[NOTE] |
| 1613 |
==== |
| 1614 |
These features are verified by tests in {repo-blob-url}/test/test_todos.rb[test_todos.rb]. |
| 1615 |
==== |
| 1616 |
|
| 1617 |
You can typeset todo notes by using the `*todo*` environment. |
| 1618 |
|
| 1619 |
By using `*\mn*` at the beginning of the environment you can set the following attributes: |
| 1620 |
|
| 1621 |
`reviewer` (_optional_):: |
| 1622 |
Name of the reviewer |
| 1623 |
`from` (_optional_):: |
| 1624 |
Starting target anchor |
| 1625 |
`to` (_optional_):: |
| 1626 |
Ending target anchor |
| 1627 |
`date` (_optional_):: |
| 1628 |
Date attribute (optionally including time) |
| 1629 |
|
| 1630 |
Here is a full example: |
| 1631 |
|
| 1632 |
[cols="a,a"] |
| 1633 |
|=== |
| 1634 |
|[source,latex] |
| 1635 |
\begin{todo} |
| 1636 |
\mn{reviewer="John Doe",date=20180125T0121,from=A,to=B} |
| 1637 |
Lorem ipsum. |
| 1638 |
\end{todo} |
| 1639 |
|[source,asciidoc] |
| 1640 |
---- |
| 1641 |
[TODO,reviewer="John Doe",date=20180125T0121,from=A,to=B] |
| 1642 |
==== |
| 1643 |
Lorem ipsum. |
| 1644 |
==== |
| 1645 |
---- |
| 1646 |
|=== |
| 1647 |
|
| 1648 |
CAUTION: The `reviewer` and `date` attributes are currently not rendered by LaTeX but only passed to Adoc. |
| 1649 |
|
| 1650 |
:leveloffset!: |