From ecdd3beb4fb3bcd9ea2f1c6349a68f74a40f1679 Mon Sep 17 00:00:00 2001
From: Norbert Preining 2.22.0-0-g5a3d0fe 2023-04-02 2.23.0-0-g0b22f91 2023-04-27
+
+\end{markdown*}
+\end{document}
diff --git a/macros/generic/markdown/examples/latex-xetex.tex b/macros/generic/markdown/examples/latex-xetex.tex
new file mode 120000
index 0000000000..d18d544a19
--- /dev/null
+++ b/macros/generic/markdown/examples/latex-xetex.tex
@@ -0,0 +1 @@
+latex-luatex.tex
\ No newline at end of file
diff --git a/macros/generic/markdown/examples/latex.tex b/macros/generic/markdown/examples/latex.tex
deleted file mode 100644
index 44736c61dc..0000000000
--- a/macros/generic/markdown/examples/latex.tex
+++ /dev/null
@@ -1,84 +0,0 @@
-\documentclass{book}
-\usepackage{ifxetex,ifluatex}
-\ifxetex
- \usepackage{polyglossia}
- \setmainlanguage{english}
- \usepackage{fontspec}
-\else\ifluatex
- \usepackage{polyglossia}
- \setmainlanguage{english}
- \usepackage{fontspec}
-\else
- \usepackage[english]{babel}
- \usepackage[utf8]{inputenc}
- \usepackage[T1]{fontenc}
- \usepackage{lmodern}
-\fi\fi
-\usepackage{booktabs}
-\usepackage[
- contentBlocks,
- debugExtensions,
- definitionLists,
- fancy_lists,
- fencedCode,
- hashEnumerators,
- inlineNotes,
- jekyllData,
- lineBlocks,
- notes,
- pipeTables,
- rawAttribute,
- smartEllipses,
- strikeThrough,
- subscripts,
- superscripts,
- tableCaptions,
- taskLists,
- texMathDollars,
- texMathDoubleBackslash,
- texMathSingleBackslash,
-]{markdown}
-\begin{markdown*}{hybrid}
----
-title: An Example *Markdown* Document
-author: Vít Novotný
-date: \today
----
-\end{markdown*}
-\begin{document}
-% Typeset the document `example.md` by letting the Markdown package handle
-% the conversion internally.
-\markdownInput{./example.md}
-
-% Typeset the document `example.tex` that we prepared separately using the
-% Lua command-line interface of the Markdown package and that contains a
-% plain TeX representation of the document `example.md`.
-\catcode`\%=12\relax
-\catcode`\#=12\relax
-\InputIfFileExists{./example.tex}{}{}
-\catcode`\%=14\relax
-\catcode`\#=6\relax
-
-\begin{markdown}
-Here are some non-ASCII characters: *ěščřžýáíé*.
-\end{markdown}
-
-\begin{markdown*}{html, hybrid}
-Here is some HTML code mixed *with Markdown*. In \TeX, the HTML code
-will be silently ignored, whereas in \TeX 4ht, the HTML code will be passed
-through to the output:
-
-
+
+ Emil
+ Tobias
+ Linus
+
+
+16
+ 14
+ 10
+
-
-\end{markdown*}
-\end{document}
diff --git a/macros/generic/markdown/libraries/markdown-tinyyaml.lua b/macros/generic/markdown/libraries/markdown-tinyyaml.lua
index 7a57ef2422..074ad79446 100644
--- a/macros/generic/markdown/libraries/markdown-tinyyaml.lua
+++ b/macros/generic/markdown/libraries/markdown-tinyyaml.lua
@@ -38,6 +38,8 @@ local tonumber = tonumber
local math = math
local getmetatable = getmetatable
local error = error
+local end_symbol = "..."
+local end_break_symbol = "...\n"
local UNESCAPES = {
['0'] = "\x00", z = "\x00", N = "\x85",
@@ -183,7 +185,14 @@ function Parser:parsestring(line, stopper)
if not i then
return nil, line
end
- return ssub(line, 2, i-1), ssub(line, i+1)
+ -- Unescape repeated single quotes.
+ while i < #line and ssub(line, i+1, i+1) == "'" do
+ i = sfind(line, "'", i + 2, true)
+ if not i then
+ return nil, line
+ end
+ end
+ return ssub(line, 2, i-1):gsub("''", "'"), ssub(line, i+1)
end
if q == '"' then
local i, buf = 2, ''
@@ -702,6 +711,13 @@ function Parser:parsemap(line, lines, indent)
while #lines > 0 do
-- Check for a new document
line = lines[1]
+ if line == end_symbol or line == end_break_symbol then
+ for i, _ in ipairs(lines) do
+ lines[i] = nil
+ end
+ return map
+ end
+
if startswith(line, '---') then
while #lines > 0 and not startswith(lines, '---') do
tremove(lines, 1)
diff --git a/macros/generic/markdown/markdown.dtx b/macros/generic/markdown/markdown.dtx
index ee878acc72..3edb022e15 100644
--- a/macros/generic/markdown/markdown.dtx
+++ b/macros/generic/markdown/markdown.dtx
@@ -796,16 +796,18 @@ abbr {
\ProvidesPackage{markdownthemewitiko_markdown_techdoc}[2022/02/23]
\RequirePackage{etoolbox}
\markdownSetup{
- rendererPrototypes = {
- codeSpan = {\inline{#1}},
- headingFour = {%
+ renderers = {
+ head*Four = {%
\paragraph{#1}\leavevmode
\def\markdownRendererInterblockSeparator{%
\let\markdownRendererInterblockSeparator\par
}%
\noindent
},
- jekyllDataEnd = {%
+ },
+ rendererPrototypes = {
+ codeSpan = {\inline{#1}},
+ jek*llDataEnd = {%
\AfterEndPreamble{%
\printtitlepage
\tableofcontents
@@ -1045,7 +1047,7 @@ a directory named `markdown` due to [issue #74][issue-74].
%
% This section gives an overview of all resources required by the package.
%
-%### Lua Requirements {#luaprerequisites}
+%### Lua Requirements {#lua-prerequisites}
%
% The Lua part of the package requires that the following Lua modules are
% available from within the Lua\TeX{} engine (though not necessarily in the
@@ -1201,7 +1203,8 @@ end)()
% (subset) parser that is used to read \acro{yaml} metadata when the
% \Opt{jekyllData} option is enabled. We carry a copy of the library
% in file `markdown-tinyyaml.lua` distributed together with the Markdown
-% package.
+% package.
%
% \end{markdown}
% \iffalse
@@ -1211,11 +1214,11 @@ end)()
% \par
% \begin{markdown}
%
-%### Plain \TeX{} Requirements {#texprerequisites}
+%### Plain \TeX{} Requirements {#tex-prerequisites}
%
% The plain \TeX{} part of the package requires that the plain \TeX{}
% format (or its superset) is loaded, all the Lua prerequisites (see
-% Section <#sec:luaprerequisites>), and the following packages:
+% Section <#sec:lua-prerequisites>), and the following packages:
%
% \pkg{expl3}
%
@@ -1275,7 +1278,7 @@ end)()
% \par
% \begin{markdown}
%
-%### \LaTeX{} Requirements {#latexprerequisites}
+%### \LaTeX{} Requirements {#latex-prerequisites}
%
% The \LaTeX{} part of the package requires that the \Hologo{LaTeX2e} format is
% loaded,
@@ -1291,12 +1294,12 @@ end)()
% \fi
% \begin{markdown}
% a \TeX{} engine that extends \Hologo{eTeX}, and all the plain \TeX{}
-% prerequisites (see Section <#sec:texprerequisites>):
+% prerequisites (see Section <#sec:tex-prerequisites>):
%
% The following packages are soft prerequisites. They are only used to provide
% default token renderer prototypes (see sections
% <#sec:texrendererprototypes> and
-% <#sec:latexdefaultrendererprototypes>) or \LaTeX{} themes (see Section
+% <#sec:latex-default-renderer-prototypes>) or \LaTeX{} themes (see Section
% <#sec:latexthemes>) and will not be loaded if the `plain` package option
% has been enabled (see Section <#sec:latexplain>):
%
@@ -1369,7 +1372,7 @@ end)()
%
%: A package that is used to polyfill the general hook management system in
% the default renderer prototypes for \acro{yaml} metadata, see Section
-% <#sec:latexyamlmetadata>, and also in the default renderer prototype
+% <#sec:latex-yaml-metadata>, and also in the default renderer prototype
% for identifier attributes.
%
% \pkg{soulutf8}
@@ -1402,7 +1405,7 @@ end)()
%### \Hologo{ConTeXt} Prerequisites
% The \Hologo{ConTeXt} part of the package requires that either the Mark II or
% the Mark IV format is loaded, all the plain \TeX{} prerequisites (see
-% Section <#sec:texprerequisites>), and the following \Hologo{ConTeXt}
+% Section <#sec:tex-prerequisites>), and the following \Hologo{ConTeXt}
% modules:
%
% \pkg{m-database}
@@ -1601,13 +1604,14 @@ the Markdown package:
``` sh
git clone https://github.com/witiko/markdown
cd markdown/examples
-lualatex latex.tex
+lualatex latex-luatex.tex
``````
-A PDF document named `latex.pdf` should be produced. Open the text documents
-`latex.tex` and `example.md` in a text editor to see how the example documents
-are structured. Try changing the documents and typesetting them as follows:
+A PDF document named `latex-luatex.pdf` should be produced. Open the text
+documents `latex-luatex.tex` and `example.md` in a text editor to see how the
+example documents are structured. Try changing the documents and typesetting
+them as follows:
``` sh
-lualatex latex.tex
+lualatex latex-luatex.tex
``````
to see the effect of your changes.
@@ -1628,10 +1632,7 @@ Next, invoke LuaTeX from the terminal:
context document.tex
``````
A PDF document named `document.pdf` should be produced and contain the text “Hello
-*world*!” Invoking pdfTeX should have the same effect:
-``` sh
-texexec --passon=--shell-escape document.tex
-``````
+*world*!”
***
@@ -1714,12 +1715,12 @@ local M = {metadata = metadata}
% \par
% \begin{markdown}
%
-%### Conversion from Markdown to Plain \TeX{} {#luaconversion}
+%### Conversion from Markdown to Plain \TeX{} {#lua-conversion}
%
% The Lua interface exposes the \luamdef{new}`(options)` function. This
% function returns a conversion function from markdown to plain \TeX{} according
% to the table `options` that contains options recognized by the Lua interface
-% (see Section <#sec:luaoptions>). The `options` parameter is optional; when
+% (see Section <#sec:lua-options>). The `options` parameter is optional; when
% unspecified, the behaviour will be the same as if `options` were an empty
% table.
%
@@ -1732,7 +1733,7 @@ local M = {metadata = metadata}
% print(convert("Hello *world*!"))
% ```````
%
-%### User-Defined Syntax Extensions {#luauserextensions}
+%### User-Defined Syntax Extensions {#lua-user-extensions}
%
% For the purpose of user-defined syntax extensions, the Lua interface also
% exposes the \luamdef{reader} object, which performs the lexical and
@@ -1966,7 +1967,7 @@ pdftex document.tex
% \fi
% \begin{markdown}
%
-%### Options {#luaoptions}
+%### Options {#lua-options}
%
% The Lua interface recognizes the following options. When unspecified, the
% value of a key is taken from the \luamdef{defaultOptions} table.
@@ -2081,7 +2082,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces.
}
{
\msg_error:nnnV
- { @@ }
+ { markdown }
{ failed-typecheck-for-boolean-option }
{ #1 }
\l_tmpa_tl
@@ -2090,7 +2091,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces.
}
}
\msg_new:nnn
- { @@ }
+ { markdown }
{ failed-typecheck-for-boolean-option }
{
Option~#1~has~value~#2,~
@@ -2139,7 +2140,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces.
\l_tmpa_bool
{
\msg_error:nnn
- { @@ }
+ { markdown }
{ undefined-option }
{ #1 }
}
@@ -2148,7 +2149,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces.
\l_tmpa_tl
{
\msg_error:nnnV
- { @@ }
+ { markdown }
{ unknown-option-type }
{ #1 }
\l_tmpa_tl
@@ -2158,13 +2159,13 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces.
\l_tmpa_tl
}
\msg_new:nnn
- { @@ }
+ { markdown }
{ unknown-option-type }
{
Option~#1~has~unknown~type~#2.
}
\msg_new:nnn
- { @@ }
+ { markdown }
{ undefined-option }
{
Option~#1~is~undefined.
@@ -2191,7 +2192,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces.
\l_tmpa_bool
{
\msg_error:nnn
- { @@ }
+ { markdown }
{ undefined-option }
{ #1 }
}
@@ -2247,7 +2248,17 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces.
\tl_tail:n { #1 }
}
}
-\seq_new:N \g_@@_cases_seq
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% To make it easier to support different coding styles in the interface,
+% engines, we define the \mdef{\@\@_with_various_cases:nn} function
+% that allows us to generate different variants of a string using
+% different cases.
+%
+% \end{markdown}
+% \begin{macrocode}
\cs_new:Nn \@@_with_various_cases:nn
{
\seq_clear:N
@@ -2268,6 +2279,29 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces.
\l_tmpa_seq
{ #2 }
}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% To interrupt the \mref{\@\@_with_various_cases:nn} function
+% prematurely, use the \mdef{\@\@_with_various_cases_break:} function.
+%
+% \end{markdown}
+% \begin{macrocode}
+\cs_new:Nn \@@_with_various_cases_break:
+ {
+ \seq_map_break:
+ }
+% \end{macrocode}
+% \begin{markdown}
+%
+% By default, camelCase and snake\\\_case are supported.
+% Additional cases can be added by adding functions to the
+% \mdef{g_\@\@_cases_seq} sequence.
+%
+% \end{markdown}
+% \begin{macrocode}
+\seq_new:N \g_@@_cases_seq
\cs_new:Nn \@@_camel_case:N
{
\regex_replace_all:nnN
@@ -2641,13 +2675,13 @@ defaultOptions.contentBlocksLanguageMap = "markdown-languages.json"
extensible subset of the \acro{peg} grammar of markdown
% (see the \luamref{walkable_syntax} hash table)
after built-in syntax extensions
-% (see Section <#sec:luabuiltinextensions>)
+% (see Section <#sec:lua-built-in-extensions>)
% \iffalse
(see options \Opt{citations}, \Opt{contentBlocks}, \Opt{definitionLists},
etc.)
% \fi
and user-defined syntax extensions
-% (see Section <#sec:luauserextensions>)
+% (see Section <#sec:lua-user-extensions>)
% \iffalse
(see option \Opt{extensions})
% \fi
@@ -2881,7 +2915,7 @@ Hi *world*!
```````
Last, invoke pdfTeX without shell access from the terminal:
``` sh
-texexec --passon=--no-shell-escape frozen-document.tex
+context frozen-document.tex
``````
A PDF document named `frozen-document.pdf` should be produced and contain the
text “Hello *world*!” Since we used the contents of the frozen cache using
@@ -4622,13 +4656,13 @@ defaultOptions.contentBlocks = false
extensible subset of the \acro{peg} grammar of markdown
% (see the \luamref{walkable_syntax} hash table)
after built-in syntax extensions
-% (see Section <#sec:luabuiltinextensions>)
+% (see Section <#sec:lua-built-in-extensions>)
% \iffalse
(see options \Opt{citations}, \Opt{contentBlocks},
\Opt{definitionLists}, etc.)
% \fi
and user-defined syntax extensions
-% (see Section <#sec:luauserextensions>)
+% (see Section <#sec:lua-user-extensions>)
% \iffalse
(see option \Opt{extensions})
% \fi
@@ -5194,7 +5228,7 @@ metadata.grammar_version = 2
% markdown using the interface of a Lua \luamref{reader} object, such as
% the \luamref{reader->insert_pattern} and
% \luamref{reader->add_special_character} methods,
-% see Section <#luauserextensions>.
+% see Section <#lua-user-extensions>.
%
% \end{markdown}
% \iffalse
@@ -5857,7 +5891,7 @@ Hi *world*!
```````
Last, invoke pdfTeX without shell access from the terminal:
``` sh
-texexec --passon=--no-shell-escape document.tex
+context document.tex
``````
A new PDF document named `document.pdf` should be produced and contain the
same text “Hello *world*!” Since we used the contents of the frozen cache using
@@ -10323,7 +10357,7 @@ for i = 1, #arg do
% Unless the `-`{}`-` argument has been specified before, an argument
% containing the equals sign (`=`) is assumed to be an option specification in
% a \meta{key}`=`\meta{value} format. The available options are listed in
-% Section <#sec:luaoptions>.
+% Section <#sec:lua-options>.
% \end{markdown}
% \begin{macrocode}
elseif arg[i]:match("=") then
@@ -10491,7 +10525,7 @@ pdftex --shell-escape document.tex
%
% The plain \TeX{} interface provides macros for the typesetting of markdown
% input from within plain \TeX{}, for setting the Lua interface options (see
-% Section <#sec:luaoptions>) used during the conversion from markdown to
+% Section <#sec:lua-options>) used during the conversion from markdown to
% plain \TeX{} and for changing the way markdown the tokens are rendered.
%
% \end{markdown}
@@ -10510,7 +10544,7 @@ pdftex --shell-escape document.tex
% \noindent It is expected that the special plain \TeX{} characters have the
% expected category codes, when `\input`ting the file.
%
-%### Typesetting Markdown {#textypesetting}
+%### Typesetting Markdown {#tex-typesetting}
%
% The interface exposes the \mdef{markdownBegin}, \mdef{markdownEnd},
% \mdef{markdownInput}, and \mdef{markdownEscape} macros.
@@ -10607,11 +10641,11 @@ pdftex --shell-escape document.tex
% \par
% \begin{markdown}
%
-%### Options {#texoptions}
+%### Options {#tex-options}
%
% The plain \TeX{} options are represented by \TeX{} commands. Some of them map
% directly to the options recognized by the Lua interface (see
-% Section <#sec:luaoptions>), while some of them are specific to the plain
+% Section <#sec:lua-options>), while some of them are specific to the plain
% \TeX{} interface.
%
% To enable the enumeration of plain \TeX{} options, we will maintain the
@@ -10880,7 +10914,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
%
% Furthemore, we also define macros that map directly to the options recognized
% by the Lua interface, such as \mdef{markdownOptionHybrid} for the
-% \Opt{hybrid} Lua option (see Section <#sec:luaoptions>), which are not
+% \Opt{hybrid} Lua option (see Section <#sec:lua-options>), which are not
% processed by the plain \TeX{} implementation, only passed along to Lua.
%
% For the macros that correspond to the non-boolean options recognized by the
@@ -11125,7 +11159,7 @@ In this section, I will describe the individual token renderers.
%
% The following \TeX{} macros may occur inside the output of the
% converter functions exposed by the Lua interface (see Section
-% <#sec:luaconversion>) and represent the parsed markdown tokens. These
+% <#sec:lua-conversion>) and represent the parsed markdown tokens. These
% macros are intended to be redefined by the user who is typesetting a
% document. By default, they point to the corresponding prototypes (see Section
% <#sec:texrendererprototypes>).
@@ -12637,8 +12671,8 @@ list is not tight). The macro receives no arguments.
% \begin{markdown}
The \mdef{markdownRendererDlBeginTight} macro represents the beginning of a
-definition list that contains an item with several paragraphs of text (the
-list is not tight). This macro will only be produced, when the
+definition list that contains no item with several paragraphs of text (the
+list is tight). This macro will only be produced, when the
\Opt{tightLists} option is disabled. The macro receives no arguments.
% \end{markdown}
@@ -18540,7 +18574,7 @@ following text:
% \begin{markdown}
% The macro is exposed in the interface, so that the user can create their own
% markdown environments. Due to the way the arguments are passed to Lua (see
-% Section <#sec:directlua>), the first argument may not contain the
+% Section <#sec:direct-lua>), the first argument may not contain the
% string `]]` (regardless of the category code of the bracket symbol (`]`)).
%
% The \mdef{markdownMode} macro specifies how the plain \TeX{} implementation
@@ -18677,7 +18711,7 @@ pdflatex --shell-escape document.tex
% Section <#sec:texinterface>).
%
% The \LaTeX{} implementation redefines the plain \TeX{} logging macros (see
-% Section <#sec:texinterfacelogging>) to use the \LaTeX{} `\PackageInfo`,
+% Section <#sec:tex-interface-logging>) to use the \LaTeX{} `\PackageInfo`,
% `\PackageWarning`, and `\PackageError` macros.
%
% \end{markdown}
@@ -18697,10 +18731,10 @@ pdflatex --shell-escape document.tex
% \end{Verbatim}
% \begin{markdown}
% where \meta{options} are the \LaTeX{} interface options (see Section
-% <#sec:latexoptions>). Note that \meta{options} inside the `\usepackage`
+% <#sec:latex-options>). Note that \meta{options} inside the `\usepackage`
% macro may not set the `markdownRenderers` (see Section
-% <#sec:latexrenderers>) and `markdownRendererPrototypes` (see Section
-% <#sec:latexrendererprototypes>) keys. Furthermore, although the
+% <#sec:latex-renderers>) and `markdownRendererPrototypes` (see Section
+% <#sec:latex-renderer-prototypes>) keys. Furthermore, although the
% base variant of the `import` key that loads a single \LaTeX{} theme
% (see Section <#sec:latexthemes>) can be used, the extended variant
% that can load multiple themes and import snippets from them (see
@@ -18718,7 +18752,7 @@ pdflatex --shell-escape document.tex
% The \envmref{markdown} and \envmref{markdown*} \LaTeX{} environments are used to
% typeset markdown document fragments. The starred version of the
% \envmref{markdown} environment accepts \LaTeX{} interface options (see
-% Section <#sec:latexoptions>) as its only argument. These options will
+% Section <#sec:latex-options>) as its only argument. These options will
% only influence this markdown document fragment.
%
% \end{markdown}
@@ -18755,7 +18789,7 @@ pdflatex --shell-escape document.tex
% the filename of a markdown document and expands to the result of the
% conversion of the input markdown document to plain \TeX{}. Unlike the
% \mref{markdownInput} macro provided by the plain \TeX{} interface, this macro
-% also accepts \LaTeX{} interface options (see Section <#sec:latexoptions>)
+% also accepts \LaTeX{} interface options (see Section <#sec:latex-options>)
% as its optional argument. These options will only influnce this markdown
% document.
%
@@ -18771,7 +18805,7 @@ pdflatex --shell-escape document.tex
% \end{document}
% ```````
%
-%### Options {#latexoptions}
+%### Options {#latex-options}
%
% The \LaTeX{} options are represented by a comma-delimited list of
% \meta{key}`=`\meta{value} pairs. For boolean options, the `=`\meta{value}
@@ -18780,9 +18814,9 @@ pdflatex --shell-escape document.tex
%
% Except for the `plain` option described in Section <#sec:latexplain>, and
% the \LaTeX{} themes described in Section <#sec:latexthemes>, and the
-% \LaTeX{} snippets described in Section <#sec:latexsetupsnippets>,
+% \LaTeX{} snippets described in Section <#sec:latex-setup-snippets>,
% \LaTeX{} options map directly to the options recognized by the plain
-% \TeX{} interface (see Section <#sec:texoptions>) and to the markdown token
+% \TeX{} interface (see Section <#sec:tex-options>) and to the markdown token
% renderers and their prototypes recognized by the plain \TeX{} interface (see
% Sections <#sec:texrenderersuser> and <#sec:texrendererprototypes>).
%
@@ -18807,7 +18841,7 @@ pdflatex --shell-escape document.tex
% \end{macrocode}
% \begin{markdown}
%
-%#### \LaTeX{} snippets {#latexsetupsnippets}
+%#### \LaTeX{} snippets {#latex-setup-snippets}
%
% We may also set up \LaTeX{} options as *snippets* using the
% \mdef{markdownSetupSnippet} macro and invoke them later. The
@@ -18939,9 +18973,9 @@ other packages used in a document. Additionally, if we redefine token
renderers and renderer prototypes ourselves, the default definitions will bring
no benefit to us. Using the `plain` package option, we can keep the default
definitions from the plain \TeX{} implementation
-% (see Section <#sec:textokenrendererprototypes>)
+% (see Section <#sec:tex-token-renderer-prototypes>)
and prevent the soft \LaTeX{} prerequisites
-% in Section <#sec:latexprerequisites>
+% in Section <#sec:latex-prerequisites>
from being loaded: The plain option must be set before or when loading the
package. Setting the option after loading the package will have no effect.
@@ -19112,7 +19146,7 @@ would use the following code in the preamble of your document:
% \begin{markdown}
%
% The \LaTeX{} themes have a useful synergy with snippets (see Section
-% <#sec:latexsetupsnippets>): To make it less likely that different themes
+% <#sec:latex-setup-snippets>): To make it less likely that different themes
% will set up snippets with the same name, we will prepend \meta{theme
% name}`/` before the snippet name and use the result as the snippet name.
% For example, if the `witiko/dot` theme sets up the `product` snippet, the
@@ -19406,7 +19440,7 @@ following text, where the middot (`·`) denotes a non-breaking space:
% \par
% \begin{markdown}
%
-% Please, see Section <#sec:latexthemesimplementation> for implementation
+% Please, see Section <#sec:latex-themes-implementation> for implementation
% details of the example themes.
#### \LaTeX{} snippets {#latexsnippets}
@@ -19483,7 +19517,8 @@ The following ordered list will be preceded by roman numerals:
```````
If the `romanNumerals` snippet were defined in the `jdoe/lists` theme,
-we can import the theme and use the qualified name of the snippet:
+we could import the `jdoe/lists` theme and use the qualified name
+`jdoe/lists/romanNumerals` to invoke the snippet:
``` tex
\markdownSetup{import=jdoe/lists}
@@ -19499,7 +19534,7 @@ The following ordered list will be preceded by roman numerals:
Alternatively, we can use the extended variant of the `import` \LaTeX{}
option that allows us to import the `romanNumerals` snippet to the
-current namespace, so that we can invoke the snippet with less typing:
+current namespace for easier access:
``` tex
\markdownSetup{
@@ -19518,8 +19553,9 @@ The following ordered list will be preceded by roman numerals:
```````
Furthermore, we can also specify the name of the snippet in the current
-namespace, which is different from the name of the snippet in the
-`jdoe/lists` theme:
+namespace, which can be different from the name of the snippet in the
+`jdoe/lists` theme. For example, we can make the snippet
+`jdoe/lists/romanNumerals` available under the name `roman`.
``` tex
\markdownSetup{
@@ -19538,7 +19574,23 @@ The following ordered list will be preceded by roman numerals:
```````
Several themes and/or snippets can be loaded at once using the extended
-variant of the `import` \LaTeX{} option.
+variant of the `import` \LaTeX{} option:
+
+``` tex
+\markdownSetup{
+ import = {
+ jdoe/longpackagename/lists = {
+ arabic as arabic1,
+ roman,
+ alphabetic,
+ },
+ jdoe/anotherlongpackagename/lists = {
+ arabic as arabic2,
+ },
+ jdoe/yetanotherlongpackagename,
+ },
+}
+```````
% \markdownEnd
% \iffalse
@@ -19752,7 +19804,7 @@ variant of the `import` \LaTeX{} option.
{ s }
{
\msg_error:nnn
- { @@ }
+ { markdown }
{ malformed-name-for-clist-option }
{ #3 }
}
@@ -19798,7 +19850,7 @@ variant of the `import` \LaTeX{} option.
{ en }
{ F }
\msg_new:nnn
- { @@ }
+ { markdown }
{ malformed-name-for-clist-option }
{
Clist~option~name~#1~does~not~end~with~-s.
@@ -19851,12 +19903,13 @@ variant of the `import` \LaTeX{} option.
% }
% ```````
%
-%#### Plain \TeX{} Markdown Token Renderers {#latexrenderers}
+%#### Plain \TeX{} Markdown Token Renderers {#latex-renderers}
%
% The \LaTeX{} interface recognizes an option with the `renderers` key,
-% whose value must be a list of options that map directly to the markdown token
-% renderer macros exposed by the plain \TeX{} interface (see Section
-% <#sec:texrenderersuser>).
+% whose value must be a list of key-values, where the keys correspond
+% to the markdown token renderer macros exposed by the plain \TeX{}
+% interface (see Section <#sec:texrenderersuser>) and the values are
+% new definitions of these token renderers.
%
% \end{markdown}
% \begin{macrocode}
@@ -19932,12 +19985,119 @@ variant of the `import` \LaTeX{} option.
% }
% ```````
%
-%#### Plain \TeX{} Markdown Token Renderer Prototypes {#latexrendererprototypes}
+% In addition to exact token renderer names, we also support wildcards
+% that match multiple token renderer names.
+%
+% \end{markdown}
+% \begin{macrocode}
+\ExplSyntaxOn
+\tl_new:N
+ \l_@@_renderer_definition_tl
+\keys_define:nn
+ { markdown/latex-options/renderers }
+ {
+ unknown .code:n = {
+ \regex_match:nVTF
+ { \* }
+ \l_keys_key_str
+ {
+ \tl_set:Nn
+ \l_@@_renderer_definition_tl
+ { #1 }
+ \tl_set:NV
+ \l_tmpa_tl
+ \l_keys_key_str
+ \regex_replace_all:nnN
+ { \* }
+ { .* }
+ \l_tmpa_tl
+ \regex_set:NV
+ \l_tmpa_regex
+ \l_tmpa_tl
+ \int_zero:N
+ \l_tmpa_int
+ \seq_map_inline:Nn
+ \g_@@_renderers_seq
+ {
+ \@@_with_various_cases:nn
+ { ##1 }
+ {
+ \regex_match:NnT
+ \l_tmpa_regex
+ { ####1 }
+ {
+ \@@_renderer_tl_to_csname:nN
+ { ##1 }
+ \l_tmpa_tl
+ \prop_get:NnN
+ \g_@@_renderer_arities_prop
+ { ##1 }
+ \l_tmpb_tl
+ \cs_generate_from_arg_count:cNVV
+ { \l_tmpa_tl }
+ \cs_set:Npn
+ \l_tmpb_tl
+ \l_@@_renderer_definition_tl
+ \int_incr:N
+ \l_tmpa_int
+ \@@_with_various_cases_break:
+ }
+ }
+ }
+ \int_compare:nNnT
+ { \l_tmpa_int } = { 0 }
+ {
+ \msg_error:nnV
+ { markdown }
+ { nonmatched-renderer-wildcard }
+ \l_keys_key_str
+ }
+ }
+ {
+ \msg_error:nnV
+ { markdown }
+ { undefined-renderer }
+ \l_keys_key_str
+ }
+ },
+ }
+\msg_new:nnn
+ { markdown }
+ { undefined-renderer }
+ {
+ Renderer~#1~is~undefined.
+ }
+\msg_new:nnn
+ { markdown }
+ { nonmatched-renderer-wildcard }
+ {
+ Wildcard~#1~matches~no~renderers.
+ }
+\cs_generate_variant:Nn
+ \regex_set:Nn
+ { NV }
+\cs_generate_variant:Nn
+ \cs_generate_from_arg_count:NNnn
+ { cNVV }
+\cs_generate_variant:Nn
+ \msg_error:nnn
+ { nnV }
+\prg_generate_conditional_variant:Nnn
+ \regex_match:nn
+ { nV }
+ { TF }
+\ExplSyntaxOff
+% \end{macrocode}
+% \begin{markdown}
+%
+%#### Plain \TeX{} Markdown Token Renderer Prototypes {#latex-renderer-prototypes}
%
-% The \LaTeX{} interface recognizes an option with the `rendererPrototypes`
-% key, whose value must be a list of options that map directly to the markdown
-% token renderer prototype macros exposed by the plain \TeX{} interface (see
-% Section <#sec:texrendererprototypes>).
+% The \LaTeX{} interface recognizes an option with the
+% `rendererPrototypes` key, whose value must be a list of key-values,
+% where the keys correspond to the markdown token renderer prototype
+% macros exposed by the plain \TeX{} interface (see Section
+% <#sec:texrendererprototypes>) and the values are new definitions of
+% these token renderer prototypes.
%
% \end{markdown}
% \begin{macrocode}
@@ -20000,6 +20160,111 @@ variant of the `import` \LaTeX{} option.
% }
% ```````
%
+% In addition to exact token renderer prototype names, we also support
+% wildcards that match multiple token renderer prototype names.
+%
+% \end{markdown}
+% \begin{macrocode}
+\ExplSyntaxOn
+\tl_new:N
+ \l_@@_renderer_prototype_definition_tl
+\keys_define:nn
+ { markdown/latex-options/renderer-prototypes }
+ {
+ unknown .code:n = {
+ \regex_match:nVTF
+ { \* }
+ \l_keys_key_str
+ {
+ \tl_set:Nn
+ \l_@@_renderer_prototype_definition_tl
+ { #1 }
+ \tl_set:NV
+ \l_tmpa_tl
+ \l_keys_key_str
+ \regex_replace_all:nnN
+ { \* }
+ { .* }
+ \l_tmpa_tl
+ \regex_set:NV
+ \l_tmpa_regex
+ \l_tmpa_tl
+ \int_zero:N
+ \l_tmpa_int
+ \seq_map_inline:Nn
+ \g_@@_renderers_seq
+ {
+ \@@_with_various_cases:nn
+ { ##1 }
+ {
+ \regex_match:NnT
+ \l_tmpa_regex
+ { ####1 }
+ {
+ \@@_renderer_prototype_tl_to_csname:nN
+ { ##1 }
+ \l_tmpa_tl
+ \prop_get:NnN
+ \g_@@_renderer_arities_prop
+ { ##1 }
+ \l_tmpb_tl
+ \cs_generate_from_arg_count:cNVV
+ { \l_tmpa_tl }
+ \cs_set:Npn
+ \l_tmpb_tl
+ \l_@@_renderer_prototype_definition_tl
+ \int_incr:N
+ \l_tmpa_int
+ \@@_with_various_cases_break:
+ }
+ }
+ }
+ \int_compare:nNnT
+ { \l_tmpa_int } = { 0 }
+ {
+ \msg_error:nnV
+ { markdown }
+ { nonmatched-renderer-prototype-wildcard }
+ \l_keys_key_str
+ }
+ }
+ {
+ \msg_error:nnV
+ { markdown }
+ { undefined-renderer-prototype }
+ \l_keys_key_str
+ }
+ },
+ }
+\msg_new:nnn
+ { markdown }
+ { undefined-renderer-prototype }
+ {
+ Renderer~prototype~#1~is~undefined.
+ }
+\msg_new:nnn
+ { markdown }
+ { nonmatched-renderer-prototype-wildcard }
+ {
+ Wildcard~#1~matches~no~renderer~prototypes.
+ }
+\cs_generate_variant:Nn
+ \regex_set:Nn
+ { NV }
+\cs_generate_variant:Nn
+ \cs_generate_from_arg_count:NNnn
+ { cNVV }
+\cs_generate_variant:Nn
+ \msg_error:nnn
+ { nnV }
+\prg_generate_conditional_variant:Nnn
+ \regex_match:nn
+ { nV }
+ { TF }
+\ExplSyntaxOff
+% \end{macrocode}
+% \begin{markdown}
+%
% \iffalse
%
%<*context>
@@ -20052,11 +20317,6 @@ following text:
> *equals*
> .
-Invoking pdfTeX should have the same effect:
-``` sh
-texexec --passon=--shell-escape document.tex
-``````
-
%
%<*context>
% \fi
@@ -20077,7 +20337,7 @@ texexec --passon=--shell-escape document.tex
% \begin{markdown}
%
% The \Hologo{ConTeXt} implementation redefines the plain \TeX{} logging macros
-% (see Section <#sec:texinterfacelogging>) to use the \Hologo{ConTeXt}
+% (see Section <#sec:tex-interface-logging>) to use the \Hologo{ConTeXt}
% `\writestatus` macro.
%
% \end{markdown}
@@ -20137,7 +20397,7 @@ texexec --passon=--shell-escape document.tex
% the conversion of the input markdown document to plain \TeX{}. Unlike the
% \mref{markdownInput} macro provided by the plain \TeX{} interface, this macro
% also accepts \Hologo{ConTeXt} interface options (see Section
-% <#sec:contextoptions>) as its optional argument. These options will only
+% <#sec:context-options>) as its optional argument. These options will only
% influnce this markdown document.
%
% The following example \LaTeX{} code showcases the usage of the
@@ -20151,7 +20411,7 @@ texexec --passon=--shell-escape document.tex
% \stoptext
% ```````
%
-%### Options {#contextoptions}
+%### Options {#context-options}
%
% The \Hologo{ConTeXt} options are represented by a comma-delimited list of
% \meta{key}`=`\meta{value} pairs. For boolean options, the `=`\meta{value}
@@ -20160,7 +20420,7 @@ texexec --passon=--shell-escape document.tex
% omitted.
%
% \Hologo{ConTeXt} options map directly to the options recognized by the plain
-% \TeX{} interface (see Section <#sec:texoptions>).
+% \TeX{} interface (see Section <#sec:tex-options>).
%
% The \Hologo{ConTeXt} options may be specified when using the
% \mref{inputmarkdown} macro (see Section <#sec:contextinterface>), or via the
@@ -22764,7 +23024,7 @@ end
% \par
% \begin{markdown}
%
-%### Plain \TeX{} Writer {#texwriter}
+%### Plain \TeX{} Writer {#tex-writer}
%
% This section documents the \luamref{writer} object, which implements the
% routines for producing the \TeX{} output. The object is an amalgamate of the
@@ -22787,7 +23047,7 @@ M.writer = {}
%
% The \luamdef{writer.new} method creates and returns a new \TeX{} writer
% object associated with the Lua interface options (see Section
-% <#sec:luaoptions>) `options`. When `options` are unspecified, it is
+% <#sec:lua-options>) `options`. When `options` are unspecified, it is
% assumed that an empty table was passed to the method.
%
% The objects produced by the \luamref{writer.new} method expose instance methods
@@ -23085,7 +23345,7 @@ function M.writer.new(options)
{"\\markdownRendererCodeSpan{", self.escape(s), "}"})
if attributes ~= nil then
table.insert(buf,
- "\n\\markdownRendererCodeSpanAttributeContextEnd ")
+ "\\markdownRendererCodeSpanAttributeContextEnd{}")
end
return buf
end
@@ -23113,7 +23373,7 @@ function M.writer.new(options)
"{",self.string(tit or ""),"}"})
if attributes ~= nil then
table.insert(buf,
- "\n\\markdownRendererLinkAttributeContextEnd ")
+ "\\markdownRendererLinkAttributeContextEnd{}")
end
return buf
end
@@ -23141,7 +23401,7 @@ function M.writer.new(options)
"{",self.string(tit or ""),"}"})
if attributes ~= nil then
table.insert(buf,
- "\n\\markdownRendererImageAttributeContextEnd ")
+ "\\markdownRendererImageAttributeContextEnd{}")
end
return buf
end
@@ -23385,30 +23645,53 @@ function M.writer.new(options)
% \begin{markdown}
%
% Define \luamdef{writer->attributes} as a function that will transform
-% input attributes `attr` to the output format.
+% input attributes `attrs` to the output format.
%
% \end{markdown}
% \begin{macrocode}
- function self.attributes(attr)
- local buf = {}
+ function self.attributes(attributes)
+ local expanded_attributes = {}
+ local key_value_regex = "([^= ]+)%s*=%s*(.*)"
+ local key, value
+ for _, attribute in ipairs(attributes) do
+ if attribute:sub(1, 1) == "#" or attribute:sub(1, 1) == "." then
+ table.insert(expanded_attributes, attribute)
+ else
+ key, value = attribute:match(key_value_regex)
+ if key:lower() == "id" then
+ table.insert(expanded_attributes, "#" .. value)
+ elseif key:lower() == "class" then
+ local classes = {}
+ for class in value:gmatch("%S+") do
+ table.insert(classes, class)
+ end
+ table.sort(classes)
+ for _, class in ipairs(classes) do
+ table.insert(expanded_attributes, "." .. class)
+ end
+ else
+ table.insert(expanded_attributes, attribute)
+ end
+ end
+ end
+ table.sort(expanded_attributes)
- table.sort(attr)
+ local buf = {}
local seen = {}
- local key, value
- for i = 1, #attr do
- if seen[attr[i]] ~= nil then
+ for _, attribute in ipairs(expanded_attributes) do
+ if seen[attribute] ~= nil then
goto continue -- prevent duplicate attributes
else
- seen[attr[i]] = true
+ seen[attribute] = true
end
- if attr[i]:sub(1, 1) == "#" then
+ if attribute:sub(1, 1) == "#" then
table.insert(buf, {"\\markdownRendererAttributeIdentifier{",
- attr[i]:sub(2), "}"})
- elseif attr[i]:sub(1, 1) == "." then
+ attribute:sub(2), "}"})
+ elseif attribute:sub(1, 1) == "." then
table.insert(buf, {"\\markdownRendererAttributeClassName{",
- attr[i]:sub(2), "}"})
+ attribute:sub(2), "}"})
else
- key, value = attr[i]:match("([^= ]+)%s*=%s*(.*)")
+ key, value = attribute:match(key_value_regex)
table.insert(buf, {"\\markdownRendererAttributeKeyValue{",
key, "}{", value, "}"})
end
@@ -23866,13 +24149,16 @@ parsers.commented_line = Cg(Cc(""), "backslashes")
parsers.chunk = parsers.line * (parsers.optionallyindentedline
- parsers.blankline)^0
-parsers.attribute_key_char = parsers.alphanumeric + S("_-")
+parsers.attribute_key_char = parsers.alphanumeric + S("-_:.")
parsers.attribute_key = (parsers.attribute_key_char
- parsers.dash - parsers.digit)
* parsers.attribute_key_char^0
parsers.attribute_value = ( (parsers.dquote / "")
* (parsers.anyescaped - parsers.dquote)^0
* (parsers.dquote / ""))
+ + ( (parsers.squote / "")
+ * (parsers.anyescaped - parsers.squote)^0
+ * (parsers.squote / ""))
+ ( parsers.anyescaped - parsers.dquote - parsers.rbrace
- parsers.space)^0
@@ -24247,7 +24533,7 @@ end
% \par
% \begin{markdown}
%
-%### Markdown Reader {#markdownreader}
+%### Markdown Reader {#markdown-reader}
%
% This section documents the \luamref{reader} object, which implements the
% routines for parsing the markdown input. The object corresponds to the
@@ -24256,7 +24542,7 @@ end
%
% The \luamdef{reader.new} method creates and returns a new \TeX{} reader
% object associated with the Lua interface options (see Section
-% <#sec:luaoptions>) `options` and with a writer object `writer`. When
+% <#sec:lua-options>) `options` and with a writer object `writer`. When
% `options` are unspecified, it is assumed that an empty table was passed to
% the method.
%
@@ -25321,7 +25607,7 @@ end
% \begin{markdown}
%
% Although the interface of the \luamref{reader->insert_pattern} method does
-% document this (see Section <#sec:luauserextensions>), we allow the
+% document this (see Section <#sec:lua-user-extensions>), we allow the
% \luamref{reader->insert_pattern} and \luamref{reader->update_rule}
% methods to insert not just \acro{peg} patterns, but also rule names that
% reference the \acro{peg} grammar of Markdown.
@@ -25438,7 +25724,7 @@ end
% \begin{markdown}
% When determining the name of the cache file, create salt for the hashing
% function out of the package version and the passed options recognized by the
-% Lua interface (see Section <#sec:luaoptions>). The \Opt{cacheDir} option
+% Lua interface (see Section <#sec:lua-options>). The \Opt{cacheDir} option
% is disregarded.
% \end{markdown}
% \begin{macrocode}
@@ -25509,7 +25795,7 @@ end
% \end{macrocode}
% \begin{markdown}
%
-%### Built-In Syntax Extensions {#luabuiltinextensions}
+%### Built-In Syntax Extensions {#lua-built-in-extensions}
%
% Create \luamref{extensions} hash table that contains built-in syntax
% extensions. Syntax extensions are functions that produce objects with two
@@ -27611,6 +27897,7 @@ M.extensions.jekyll_data = function(expect_jekyll_data)
, function(s, i, text) -- luacheck: ignore s i
local data
local ran_ok, _ = pcall(function()
+ -- TODO: Replace with `require("tinyyaml")` in TeX Live 2023
local tinyyaml = require("markdown-tinyyaml")
data = tinyyaml.parse(text, {timestamps=false})
end)
@@ -27654,7 +27941,7 @@ end
%
% The \luamref{new} function returns a conversion function that takes a
% markdown string and turns it into a plain \TeX{} output. See Section
-% <#sec:luaconversion>.
+% <#sec:lua-conversion>.
%
% \end{markdown}
% \begin{macrocode}
@@ -27883,7 +28170,7 @@ function M.new(options)
%
% Finally, cast the user-defined syntax extension to the internal format
% of user extensions used by the Markdown package (see Section
-% <#sec:luabuiltinextensions>.)
+% <#sec:lua-built-in-extensions>.)
%
% \end{markdown}
% \begin{macrocode}
@@ -28004,7 +28291,7 @@ end
% used to implement the macros for the conversion from markdown to plain \TeX{}
% exposed by the plain \TeX{} interface (see Section <#sec:texinterface>).
%
-%### Logging Facilities {#texinterfacelogging}
+%### Logging Facilities {#tex-interface-logging}
%
% \end{markdown}
% \begin{macrocode}
@@ -28025,7 +28312,7 @@ end
% \par
% \begin{markdown}
%
-%### Token Renderer Prototypes {#textokenrendererprototypes}
+%### Token Renderer Prototypes {#tex-token-renderer-prototypes}
%
% The following definitions should be considered placeholder.
%
@@ -28205,7 +28492,7 @@ end
% \par
% \begin{markdown}
%
-%#### YAML Metadata Renderer Prototypes {#expl3yamlmetadataimplementation}
+%#### YAML Metadata Renderer Prototypes {#expl3-yaml-metadata-implementation}
%
% To keep track of the current type of structure we inhabit when we are
% traversing a \acro{yaml} document, we will maintain the
@@ -28445,8 +28732,8 @@ end
%### Lua Snippets
% After the \mdef{markdownPrepareLuaOptions} macro has been fully expanded,
% the \mdef{markdownLuaOptions} macro will expands to a Lua table that
-% contains the plain \TeX{} options (see Section <#sec:texoptions>) in a
-% format recognized by Lua (see Section <#sec:luaoptions>).
+% contains the plain \TeX{} options (see Section <#sec:tex-options>) in a
+% format recognized by Lua (see Section <#sec:lua-options>).
%
% \end{markdown}
% \begin{macrocode}
@@ -28573,8 +28860,9 @@ end
% \end{markdown}
% \begin{macrocode}
\ExplSyntaxOn
-\cs_new:Nn
- \@@_if_option:nTF
+\prg_new_conditional:Nnn
+ \@@_if_option:n
+ { TF, T, F }
{
\@@_get_option_type:nN
{ #1 }
@@ -28584,7 +28872,7 @@ end
\c_@@_option_type_boolean_tl
{
\msg_error:nnxx
- { @@ }
+ { markdown }
{ expected-boolean-option }
{ #1 }
{ \l_tmpa_tl }
@@ -28595,11 +28883,11 @@ end
\str_if_eq:NNTF
\l_tmpa_tl
\c_@@_option_value_true_tl
- { #2 }
- { #3 }
+ { \prg_return_true: }
+ { \prg_return_false: }
}
\msg_new:nnn
- { @@ }
+ { markdown }
{ expected-boolean-option }
{
Option~#1~has~type~#2,~
@@ -28812,14 +29100,14 @@ end
% \end{macrocode}
% \begin{markdown}
%
-%### Lua Shell Escape Bridge {#luabridge}
+%### Lua Shell Escape Bridge {#lua-bridge}
%
% The following \TeX{} code is intended for \TeX{} engines that do not provide
% direct access to Lua, but expose the shell of the operating system. This
% corresponds to the \mref{markdownMode} values of `0` and `1`.
%
% The \mref{markdownLuaExecute} macro defined here and in Section
-% <#sec:directlua> are meant to be indistinguishable to the remaining code.
+% <#sec:direct-lua> are meant to be indistinguishable to the remaining code.
%
% The package assumes that although the user is not using the Lua\TeX{} engine,
% their \TeX{} distribution contains it, and uses shell access to produce and
@@ -29001,11 +29289,11 @@ end
% \par
% \begin{markdown}
%
-%### Direct Lua Access {#directlua}
+%### Direct Lua Access {#direct-lua}
%
% The following \TeX{} code is intended for \TeX{} engines that provide
% direct access to Lua (Lua\TeX{}). The macro \mref{markdownLuaExecute} defined
-% here and in Section <#sec:luabridge> are meant to be indistinguishable to
+% here and in Section <#sec:lua-bridge> are meant to be indistinguishable to
% the remaining code. This corresponds to the \mref{markdownMode} value of `2`.
%
% \end{markdown}
@@ -29021,7 +29309,7 @@ end
% The direct Lua access version of the \mref{markdownLuaExecute} macro is defined
% in terms of the `\directlua` primitive. The `print` function is set as
% an alias to the `tex.print` method in order to mimic the behaviour of the
-% \mref{markdownLuaExecute} definition from Section <#sec:luabridge>,
+% \mref{markdownLuaExecute} definition from Section <#sec:lua-bridge>,
%
% \end{markdown}
% \begin{macrocode}
@@ -29199,7 +29487,7 @@ end
%
%### Logging Facilities
% The \LaTeX{} implementation redefines the plain \TeX{} logging macros (see
-% Section <#sec:texinterfacelogging>) to use the \LaTeX{} `\PackageInfo`,
+% Section <#sec:tex-interface-logging>) to use the \LaTeX{} `\PackageInfo`,
% `\PackageWarning`, and `\PackageError` macros.
%
% \end{markdown}
@@ -29212,7 +29500,7 @@ end
% The \mdef{markdownInputPlainTeX} macro is used to store the original plain
% \TeX{} implementation of the \mref{markdownInput} macro. The \mref{markdownInput}
% is then redefined to accept an optional argument with options recognized by
-% the \LaTeX{} interface (see Section <#sec:latexoptions>).
+% the \LaTeX{} interface (see Section <#sec:latex-options>).
%
% \end{markdown}
% \begin{macrocode}
@@ -29258,7 +29546,7 @@ end
% \par
% \begin{markdown}
%
-%#### \LaTeX{} Themes {#latexthemesimplementation}
+%#### \LaTeX{} Themes {#latex-themes-implementation}
%
% This section implements the theme-loading mechanism and the example themes
% provided with the Markdown package.
@@ -29320,7 +29608,7 @@ end
% \begin{markdown}
%
% We load the \pkg{ifthen} and \pkg{grffile} packages, see also
-% Section <#sec:latexprerequisites>:
+% Section <#sec:latex-prerequisites>:
%
% \end{markdown}
% \begin{macrocode}
@@ -29394,7 +29682,7 @@ end
% \begin{markdown}
%
% We load the \pkg{catchfile} and \pkg{grffile} packages, see also
-% Section <#sec:latexprerequisites>:
+% Section <#sec:latex-prerequisites>:
%
% \end{markdown}
% \begin{macrocode}
@@ -29655,7 +29943,7 @@ end
% \par
% \begin{markdown}
%
-%### Token Renderer Prototypes {#latexdefaultrendererprototypes}
+%### Token Renderer Prototypes {#latex-default-renderer-prototypes}
%
% The following configuration should be considered placeholder. If the `plain`
% package option has been enabled (see Section <#sec:latexplain>), none of
@@ -29742,8 +30030,25 @@ end
{ #2 }
}
\markdownSetup{rendererPrototypes={
- ulBeginTight = {\begin{compactitem}},
- ulEndTight = {\end{compactitem}},
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Make tight bullet lists a little less compact by adding extra vertical space
+% above and below them.
+%
+% \end{markdown}
+% \begin{macrocode}
+ ulBeginTight = {%
+ \group_begin:
+ \pltopsep=\topsep
+ \plpartopsep=\partopsep
+ \begin{compactitem}
+ },
+ ulEndTight = {
+ \end{compactitem}
+ \group_end:
+ },
fancyOlBegin = {
\group_begin:
\tl_set:Nn
@@ -29767,8 +30072,25 @@ end
\end{enumerate}
\group_end:
},
- olBeginTight = {\begin{compactenum}},
- olEndTight = {\end{compactenum}},
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Make tight ordered lists a little less compact by adding extra vertical
+% space above and below them.
+%
+% \end{markdown}
+% \begin{macrocode}
+ olBeginTight = {%
+ \group_begin:
+ \plpartopsep=\partopsep
+ \pltopsep=\topsep
+ \begin{compactenum}
+ },
+ olEndTight = {
+ \end{compactenum}
+ \group_end:
+ },
fancyOlBeginTight = {
\group_begin:
\tl_set:Nn
@@ -29779,7 +30101,11 @@ end
{ #2 }
\tl_set:Nn
\l_tmpa_tl
- { \begin{compactenum}[ }
+ {
+ \plpartopsep=\partopsep
+ \pltopsep=\topsep
+ \begin{compactenum}[
+ }
\tl_put_right:Nx
\l_tmpa_tl
{ \@@_latex_paralist_style:nn { #1 } { #2 } }
@@ -29801,8 +30127,25 @@ end
{ #1 }
]
},
- dlBeginTight = {\begin{compactdesc}},
- dlEndTight = {\end{compactdesc}}}}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Make tight definition lists a little less compact by adding extra
+% vertical space above and below them.
+%
+% \end{markdown}
+% \begin{macrocode}
+ dlBeginTight = {
+ \group_begin:
+ \plpartopsep=\partopsep
+ \pltopsep=\topsep
+ \begin{compactdesc}
+ },
+ dlEndTight = {
+ \end{compactdesc}
+ \group_end:
+ }}}
\cs_generate_variant:Nn
\@@_latex_fancy_list_item_label:nnn
{ VVn }
@@ -30595,7 +30938,7 @@ end
% \par
% \begin{markdown}
%
-%#### YAML Metadata {#latexyamlmetadata}
+%#### YAML Metadata {#latex-yaml-metadata}
%
% The default setup of \acro{yaml} metadata will invoke the `\title`,
% `\author`, and `\date` macros when scalar values for keys that
@@ -30701,7 +31044,7 @@ end
% \end{markdown}
% \begin{macrocode}
\ExplSyntaxOn
-\@@_if_option:nTF
+\@@_if_option:nT
{ linkAttributes }
{
\RequirePackage{graphicx}
@@ -30725,7 +31068,6 @@ end
},
}
}
- { }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -30846,7 +31188,7 @@ end
%### Typesetting Markdown
% The \mref{inputmarkdown} is defined to accept an optional argument with
% options recognized by the \Hologo{ConTeXt} interface (see Section
-% <#sec:contextoptions>).
+% <#sec:context-options>).
%
% \end{markdown}
% \begin{macrocode}
diff --git a/macros/generic/markdown/markdown.html b/macros/generic/markdown/markdown.html
index b31144bfe9..7318814624 100644
--- a/macros/generic/markdown/markdown.html
+++ b/macros/generic/markdown/markdown.html
@@ -84,7 +84,7 @@
-
- Emil
- Tobias
- Linus
-
-
-16
- 14
- 10
- Markdown Package User Manual
-
git clone https://github.com/witiko/markdown
cd markdown/examples
-lualatex latex.tex
A PDF document named latex.pdf
should be produced. Open
-the text documents latex.tex
and example.md
in
-a text editor to see how the example documents are structured. Try
-changing the documents and typesetting them as follows:
A PDF document named latex-luatex.pdf
should be
+produced. Open the text documents latex-luatex.tex
and
+example.md
in a text editor to see how the example
+documents are structured. Try changing the documents and typesetting
+them as follows:
lualatex latex.tex
lualatex latex-luatex.tex
to see the effect of your changes.
context document.tex
A PDF document named document.pdf
should be produced and
-contain the text “Hello world!” Invoking pdfTeX should have the
-same effect:
-texexec --passon=--shell-escape document.tex
+contain the text “Hello world!”
As the next step, try typesetting the example documents distributed
along with the Markdown package:
-git clone https://github.com/witiko/markdown
-cd markdown/examples
-context context.tex
+git clone https://github.com/witiko/markdown
+cd markdown/examples
+context context.tex
A PDF document named context.pdf
should be produced.
Open the text documents context.tex
and
example.md
in a text editor to see how the example
documents are structured. Try changing the documents and typesetting
them as follows:
-context context.tex
+context context.tex
to see the effect of your changes.
2 Examples
@@ -459,33 +457,33 @@ parameter is optional; when unspecified, the behaviour will be the same
as if ⟨options⟩ were an empty table.
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input lmfonts
-\input example
-\bye
+\input markdown
+\input lmfonts
+\input example
+\bye
Using a text editor, create a text document named
example.lua
with the following content:
-#!/usr/bin/env texlua
-local ran_ok, kpse = pcall(require, "kpse")
-if ran_ok then kpse.set_program_name("luatex") end
-local markdown = require("markdown")
-local input, convert_safe, convert_unsafe, paragraph
-
-= [[$\sqrt{-1}$ *equals* $i$.]]
- input = markdown.new()
- convert_safe = markdown.new({hybrid = true})
- convert_unsafe = [[\par]]
- paragraph
-print(
-(input) .. paragraph ..
- convert_safe(input)
- convert_unsafe)
+#!/usr/bin/env texlua
+local ran_ok, kpse = pcall(require, "kpse")
+if ran_ok then kpse.set_program_name("luatex") end
+local markdown = require("markdown")
+local input, convert_safe, convert_unsafe, paragraph
+
+= [[$\sqrt{-1}$ *equals* $i$.]]
+ input = markdown.new()
+ convert_safe = markdown.new({hybrid = true})
+ convert_unsafe = [[\par]]
+ paragraph
+print(
+(input) .. paragraph ..
+ convert_safe(input)
+ convert_unsafe)
Next, invoke LuaTeX from the terminal:
-texlua example.lua > example.tex
-luatex document.tex
+texlua example.lua > example.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -494,35 +492,35 @@ contain the following text:
equals .
Invoking pdfTeX should have the same effect:
-texlua example.lua > example.tex
-pdftex document.tex
+texlua example.lua > example.tex
+pdftex document.tex
Rather than use the texlua
interpreter, we can also
access the markdown
Lua module directly from our document.
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input lmfonts
-\directlua{
-
- local markdown = require("markdown")
- local input, convert_safe, convert_unsafe, paragraph
-$\string\sqrt{-1}$ *equals* $i$.]]
- input = [[
- convert_safe = markdown.new()
- convert_unsafe = markdown.new({hybrid = true})\par]]
- paragraph = [[
-
- tex.sprint(
- convert_safe(input) .. paragraph ..
- convert_unsafe(input)
- )
- }\bye
+\input markdown
+\input lmfonts
+\directlua{
+
+ local markdown = require("markdown")
+ local input, convert_safe, convert_unsafe, paragraph
+$\string\sqrt{-1}$ *equals* $i$.]]
+ input = [[
+ convert_safe = markdown.new()
+ convert_unsafe = markdown.new({hybrid = true})\par]]
+ paragraph = [[
+
+ tex.sprint(
+ convert_safe(input) .. paragraph ..
+ convert_unsafe(input)
+ )
+ }\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -546,25 +544,25 @@ Lua programming language.
command-line parameters.
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input lmfonts
-\input safe
-
-\begingroup
-\catcode`\%=12
-\input unsafe
-\endgroup
-\bye
+\input markdown
+\input lmfonts
+\input safe
+
+\begingroup
+\catcode`\%=12
+\input unsafe
+\endgroup
+\bye
Using a text editor, create a text document named
example.md
with the following content:
- $\sqrt{-1}$ *equals* $i$.
+ $\sqrt{-1}$ *equals* $i$.
Next, invoke LuaTeX from the terminal:
-texlua ⟨CLI pathname⟩ -- example.md safe.tex
-texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
-luatex document.tex
+texlua ⟨CLI pathname⟩ -- example.md safe.tex
+texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
+luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua
CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems
@@ -582,10 +580,10 @@ contain the following text:
equals .
Invoking pdfTeX should have the same effect:
-texlua ⟨CLI pathname⟩ -- example.md safe.tex
-texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
-pdftex document.tex
+texlua ⟨CLI pathname⟩ -- example.md safe.tex
+texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
+pdftex document.tex
2.1.2 Plain TeX
@@ -601,23 +599,23 @@ its own options, but now the options are specified as TeX commands.
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input lmfonts
-
-\markdownBegin
-$\sqrt{-1}$ *equals* $i$.
-\markdownEnd
-
-\def\markdownOptionHybrid{true}
-\markdownBegin
-$\sqrt{-1}$ *equals* $i$.
-\markdownEnd
-
-\bye
+\input markdown
+\input lmfonts
+
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$.
+\markdownEnd
+
+\def\markdownOptionHybrid{true}
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$.
+\markdownEnd
+
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -626,8 +624,8 @@ contain the following text:
equals .
Invoking pdfTeX should have the same effect:
-pdftex --shell-escape document.tex
+pdftex --shell-escape document.tex
2.1.3 LaTeX
@@ -649,23 +647,23 @@ or as parameters for the markdown*
LaTeX environment.
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-$\sqrt{-1}$ *equals* $i$
-\end{markdown}
-
-\begin{markdown*}{hybrid}
-$\sqrt{-1}$ *equals* $i$
-\end{markdown*}
-
-\end{document}
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+$\sqrt{-1}$ *equals* $i$
+\end{markdown}
+
+\begin{markdown*}{hybrid}
+$\sqrt{-1}$ *equals* $i$
+\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -674,8 +672,8 @@ contain the following text:
equals .
Invoking pdfTeX should have the same effect:
-pdflatex --shell-escape document.tex
+pdflatex --shell-escape document.tex
2.1.4 ConTeXt
@@ -692,23 +690,23 @@ same options as the plain TeX
interface.
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\starttext
-
-\startmarkdown
-$\sqrt{-1}$ *equals* $i$.
-\stopmarkdown
-
-\setupmarkdown[hybrid = yes]
-\startmarkdown
-$\sqrt{-1}$ *equals* $i$.
-\stopmarkdown
-
-\stoptext
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$.
+\stopmarkdown
+
+\setupmarkdown[hybrid = yes]
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$.
+\stopmarkdown
+
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -716,9 +714,6 @@ contain the following text:
equals .
-Invoking pdfTeX should have the same effect:
-texexec --passon=--shell-escape document.tex
2.2 Options
In this section, I will describe all the options recognized by the
@@ -752,18 +747,18 @@ periodically emptied.
Lua Module Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\directlua{
-
- local markdown = require("markdown")
- local convert = markdown.new({cacheDir = "cache"})
- local input = "Hello *world*!"
- tex.sprint(convert(input)) }\bye
+\input markdown
+\directlua{
+
+ local markdown = require("markdown")
+ local convert = markdown.new({cacheDir = "cache"})
+ local input = "Hello *world*!"
+ tex.sprint(convert(input)) }\bye
Create an empty directory named cache
next to our text
document. Then, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” Several cache files of the
Markdown package will also be produced in the cache
@@ -771,18 +766,18 @@ directory as we requested using the cacheDir
option.
Lua CLI Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input hello
-\bye
+\input markdown
+\input hello
+\bye
Using a text editor, create a text document named
hello.md
with the following content:
- Hello *world*!
+ Hello *world*!
Next, invoke LuaTeX from the terminal:
-texlua ⟨CLI pathname⟩ cacheDir=cache -- hello.md hello.tex
-luatex document.tex
+texlua ⟨CLI pathname⟩ cacheDir=cache -- hello.md hello.tex
+luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua
CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems
@@ -801,16 +796,16 @@ package will also be produced as we requested using the
class="tex">TeX
Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\def\markdownOptionCacheDir{cache}
-\markdownBegin
-
- Hello *world*!\markdownEnd
-\bye
+\input markdown
+\def\markdownOptionCacheDir{cache}
+\markdownBegin
+
+ Hello *world*!\markdownEnd
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A directory named
cache
containing several cache files of the Markdown
@@ -820,17 +815,17 @@ package will also be produced as we requested using the
class="latex">LaTeX
Example
Using a text editor, create a text document named
document.tex
with the following content:
\documentclass{article}
-\usepackage[cacheDir=cache]{markdown}
-\begin{document}
-\begin{markdown}
-
- Hello *world*!\end{markdown}
-\end{document}
\documentclass{article}
+\usepackage[cacheDir=cache]{markdown}
+\begin{document}
+\begin{markdown}
+
+ Hello *world*!\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A directory named
cache
containing several cache files of the Markdown
@@ -840,17 +835,17 @@ package will also be produced as we requested using the
class="tex">TeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
\usemodule[t][markdown]
-\setupmarkdown[cacheDir = cache]
-\starttext
-\startmarkdown
-
- Hello *world*!\stopmarkdown
-\stoptext
\usemodule[t][markdown]
+\setupmarkdown[cacheDir = cache]
+\starttext
+\startmarkdown
+
+ Hello *world*!\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
context document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A directory named
cache
containing several cache files of the Markdown
@@ -879,37 +874,37 @@ Marie,Curie,1867
Thomas,Edison,1847
Create also a text document named language-map.json
with
the following content:
- {"tex": "LaTeX"
- }
+ {"tex": "LaTeX"
+ }
Create also a text document named code.tex
with the
following content:
\LaTeX. This is an example code listing in
\LaTeX. This is an example code listing in
Create also a text document named part.md
with the
following content:
This is a *transcluded markdown document*.
This is a *transcluded markdown document*.
Create also a text document named document.tex
with the
following content:
\documentclass{article}
-\usepackage{minted}
-\usepackage[contentBlocks]{markdown}
-\markdownSetup{
-
- contentBlocksLanguageMap = {language-map.json},
- }\begin{document}
-\begin{markdown}
-
- /table.csv (An example table)
- /code.tex (An example code listing)
- /part.md (A file transclusion example)\end{markdown}
-\end{document}
\documentclass{article}
+\usepackage{minted}
+\usepackage[contentBlocks]{markdown}
+\markdownSetup{
+
+ contentBlocksLanguageMap = {language-map.json},
+ }\begin{document}
+\begin{markdown}
+
+ /table.csv (An example table)
+ /code.tex (An example code listing)
+ /part.md (A file transclusion example)\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -940,8 +935,8 @@ contain the following text:Table 1: An example table
-+\LaTeX. This is an example code listing in
\LaTeX. This is an example code listing in
This is a transcluded markdown document.
Create also a text document named language-map.json
with
the following content:
- {"tex": "ConTeXt"
- }
+ {"tex": "ConTeXt"
+ }
Create also a text document named code.tex
with the
following content:
\ConTeXt. This is an example code listing in
\ConTeXt. This is an example code listing in
Create also a text document named part.md
with the
following content:
This is a *transcluded markdown document*.
This is a *transcluded markdown document*.
Create also a text document named document.tex
with the
following content:
\usemodule[t][markdown]
-\setupmarkdown
-
- [
- contentBlocks = yes,
- contentBlocksLanguageMap = language-map.json,
- ]\definetyping [ConTeXt]
-\setuptyping [ConTeXt] [option=TEX]
-\starttext
-\startmarkdown
-
- /table.csv (An example table)
- /code.tex (An example code listing)
- /part.md (A file transclusion example)\stopmarkdown
-\stoptext
\usemodule[t][markdown]
+\setupmarkdown
+
+ [
+ contentBlocks = yes,
+ contentBlocksLanguageMap = language-map.json,
+ ]\definetyping [ConTeXt]
+\setuptyping [ConTeXt] [option=TEX]
+\starttext
+\startmarkdown
+
+ /table.csv (An example table)
+ /code.tex (An example code listing)
+ /part.md (A file transclusion example)\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -1017,8 +1012,8 @@ contain the following text:Table 1: An example table
-+\ConTeXt. This is an example code listing in
\ConTeXt. This is an example code listing in
This is a transcluded markdown document.
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\directlua{
-
- local markdown = require("markdown")
- local convert = markdown.new({finalizeCache = true, frozenCacheFileName = "cache.tex"})
- local input = "Hello *world*!"
- tex.sprint(convert(input)) }\bye
\input markdown
+\directlua{
+
+ local markdown = require("markdown")
+ local convert = markdown.new({finalizeCache = true, frozenCacheFileName = "cache.tex"})
+ local input = "Hello *world*!"
+ tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A frozen cache will also be
produced in the cache.tex
output file as we requested using
@@ -1082,18 +1077,18 @@ options.
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\input hello
-\bye
\input markdown
+\input hello
+\bye
Using a text editor, create a text document named
hello.md
with the following content:
Hello *world*!
Hello *world*!
Next, invoke LuaTeX from the terminal:
-texlua ⟨CLI pathname⟩ finalizeCache=true frozenCacheFileName=cache.tex -- hello.md hello.tex
-luatex document.tex
texlua ⟨CLI pathname⟩ finalizeCache=true frozenCacheFileName=cache.tex -- hello.md hello.tex
+luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua
CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems
@@ -1112,17 +1107,17 @@ options.
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\def\markdownOptionFinalizeCache{true}
-\def\markdownOptionFrozenCacheFileName{cache.tex}
-\markdownBegin
-
- Hello *world*!\markdownEnd
-\bye
\input markdown
+\def\markdownOptionFinalizeCache{true}
+\def\markdownOptionFrozenCacheFileName{cache.tex}
+\markdownBegin
+
+ Hello *world*!\markdownEnd
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A frozen cache will also be
produced in the cache.tex
output file as we requested using
@@ -1130,17 +1125,17 @@ the finalizeCache
and frozenCacheFileName
options.
Next, create a new text document frozen-document.tex
with the following content:
\input markdown
-\def\markdownOptionFrozenCache{true}
-\def\markdownOptionFrozenCacheFileName{cache.tex}
-\markdownBegin
-
- Hi *world*!\markdownEnd
-\bye
\input markdown
+\def\markdownOptionFrozenCache{true}
+\def\markdownOptionFrozenCacheFileName{cache.tex}
+\markdownBegin
+
+ Hi *world*!\markdownEnd
+\bye
Last, invoke pdfTeX without shell access from the terminal:
-pdftex -no-shell-escape frozen-document.tex
pdftex -no-shell-escape frozen-document.tex
A PDF document named frozen-document.pdf
should be
produced and contain the text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -1152,17 +1147,17 @@ in the content of the markdown document from “Hello world!” to
class="latex">LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
\documentclass[finalizecache]{article}
-\usepackage[frozenCacheFileName=cache.tex]{markdown}
-\begin{document}
-\begin{markdown}
-
- Hello *world*!\end{markdown}
-\end{document}
\documentclass[finalizecache]{article}
+\usepackage[frozenCacheFileName=cache.tex]{markdown}
+\begin{document}
+\begin{markdown}
+
+ Hello *world*!\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A frozen cache will also be
produced in the cache.tex
output file as we requested using
@@ -1170,17 +1165,17 @@ the finalizecache
and frozenCacheFileName
options.
Next, create a new text document frozen-document.tex
with the following content:
\documentclass[frozencache]{article}
-\usepackage[frozenCacheFileName=cache.tex]{markdown}
-\begin{document}
-\begin{markdown}
-
- Hi *world*!\end{markdown}
-\end{document}
\documentclass[frozencache]{article}
+\usepackage[frozenCacheFileName=cache.tex]{markdown}
+\begin{document}
+\begin{markdown}
+
+ Hi *world*!\end{markdown}
+\end{document}
Last, invoke pdfTeX without shell access from the terminal:
-pdflatex -no-shell-escape frozen-document.tex
pdflatex -no-shell-escape frozen-document.tex
A PDF document named frozen-document.pdf
should be
produced and contain the text “Hello world!” Since we used the
contents of the frozen cache using the frozencache
option,
@@ -1192,43 +1187,43 @@ reflected.
Using a text editor, create a text document named
document.tex
with the following content:
\usemodule[t][markdown]
+\setupmarkdown
+
+ [
+ finalizeCache = yes,
+ frozenCacheFileName = cache.tex,
+ ]\starttext
+\startmarkdown
+
+ Hello *world*!\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named document.pdf
should be produced and
+contain the text “Hello world!” A frozen cache will also be
+produced in the cache.tex
output file as we requested using
+the finalizeCache
and frozenCacheFileName
+options.
Next, create a new text document frozen-document.tex
+with the following content:
\usemodule[t][markdown]
\setupmarkdown
- [
+ finalizeCache = yes,
frozenCache = yes,
frozenCacheFileName = cache.tex,
]\starttext
\startmarkdown
-
+ Hello *world*!
Hi *world*!\stopmarkdown
\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
A PDF document named document.pdf
should be produced and
-contain the text “Hello world!” A frozen cache will also be
-produced in the cache.tex
output file as we requested using
-the finalizeCache
and frozenCacheFileName
-options.
Next, create a new text document frozen-document.tex
-with the following content:
\usemodule[t][markdown]
-\setupmarkdown
-
- [
- frozenCache = yes,
- frozenCacheFileName = cache.tex,
- ]\starttext
-\startmarkdown
-
- Hi *world*!\stopmarkdown
-\stoptext
Last, invoke pdfTeX without shell access from the terminal:
-texexec --passon=--no-shell-escape frozen-document.tex
context frozen-document.tex
A PDF document named frozen-document.pdf
should be
produced and contain the text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -1260,27 +1255,27 @@ blockquote.
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\input lmfonts
-\directlua{
-
- local markdown = require("markdown")
- local newline = [[^^J^^J]]
- local convert, input
-
- convert = markdown.new()
- input = "A paragraph." .. newline ..
- "> A quote." .. newline
- tex.sprint(convert(input))
-
- convert = markdown.new({blankBeforeBlockquote = true})
- input = "A paragraph." .. newline ..
- "> Not a quote." .. newline
- tex.sprint(convert(input)) }\bye
\input markdown
+\input lmfonts
+\directlua{
+
+ local markdown = require("markdown")
+ local newline = [[^^J^^J]]
+ local convert, input
+
+ convert = markdown.new()
+ input = "A paragraph." .. newline ..
+ "> A quote." .. newline
+ tex.sprint(convert(input))
+
+ convert = markdown.new({blankBeforeBlockquote = true})
+ input = "A paragraph." .. newline ..
+ "> Not a quote." .. newline
+ tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -1293,22 +1288,22 @@ contain the following text:Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+- A paragraph.> A quote?
+ A paragraph.> A quote?
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ blankBeforeBlockquote=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ blankBeforeBlockquote=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -1331,24 +1326,24 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\markdownBegin - - A paragraph. - > A quote.\markdownEnd - -\def\markdownOptionBlankBeforeBlockquote{true} -\markdownBegin - - A paragraph. - > Not a quote.\markdownEnd - -\bye
\input markdown + +\markdownBegin + + A paragraph. + > A quote.\markdownEnd + +\def\markdownOptionBlankBeforeBlockquote{true} +\markdownBegin + + A paragraph. + > Not a quote.\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1362,25 +1357,25 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - A paragraph. - > A quote.\end{markdown} - -\begin{markdown*}{blankBeforeBlockquote} - - A paragraph. - > Not a quote.\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + A paragraph. + > A quote.\end{markdown} + +\begin{markdown*}{blankBeforeBlockquote} + + A paragraph. + > Not a quote.\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1394,25 +1389,25 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\starttext - -\startmarkdown - - A paragraph. - > A quote.\stopmarkdown - -\setupmarkdown[blankBeforeBlockquote = yes] -\startmarkdown - - A paragraph. - > Not a quote.\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\starttext + +\startmarkdown + + A paragraph. + > A quote.\stopmarkdown + +\setupmarkdown[blankBeforeBlockquote = yes] +\startmarkdown + + A paragraph. + > Not a quote.\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1446,32 +1441,32 @@ fenced code block.Lua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new({fencedCode = true}) - input = "A paragraph." .. newline .. - "```" .. newline .. - "A fenced code." .. newline .. - "```" .. newline - tex.sprint(convert(input)) - - convert = markdown.new({ - fencedCode = true, blankBeforeCodeFence = true}) - input = "A paragraph." .. newline .. - "```" .. newline .. - "Not a fenced code." .. newline .. - "```" .. newline - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert, input + + convert = markdown.new({fencedCode = true}) + input = "A paragraph." .. newline .. + "```" .. newline .. + "A fenced code." .. newline .. + "```" .. newline + tex.sprint(convert(input)) + + convert = markdown.new({ + fencedCode = true, blankBeforeCodeFence = true}) + input = "A paragraph." .. newline .. + "```" .. newline .. + "Not a fenced code." .. newline .. + "```" .. newline + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1482,24 +1477,24 @@ contain the following text:Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+- A paragraph.``` -A code fence? -```
+ A paragraph.``` +A code fence? +```
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ fencedCode=true -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ fencedCode=true -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -1520,29 +1515,29 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:-\input markdown -\def\markdownOptionFencedCode{true} - -\markdownBegin - - A paragraph. - ``` - A fenced code. - ```\markdownEnd - -\def\markdownOptionBlankBeforeCodeFence{true} -\markdownBegin - - A paragraph. - ``` - Not a fenced code. - ```\markdownEnd - -\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
+\input markdown +\def\markdownOptionFencedCode{true} + +\markdownBegin + + A paragraph. + ``` + A fenced code. + ```\markdownEnd + +\def\markdownOptionBlankBeforeCodeFence{true} +\markdownBegin + + A paragraph. + ``` + Not a fenced code. + ```\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
+luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1554,29 +1549,29 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[fencedCode]{markdown} -\begin{document} - -\begin{markdown} - - A paragraph. - ``` - A fenced code. - ```\end{markdown} - -\begin{markdown*}{blankBeforeCodeFence} - - A paragraph. - ``` - Not a fenced code. - ```\end{markdown*} - -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage[fencedCode]{markdown} +\begin{document} + +\begin{markdown} + + A paragraph. + ``` + A fenced code. + ```\end{markdown} + +\begin{markdown*}{blankBeforeCodeFence} + + A paragraph. + ``` + Not a fenced code. + ```\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1588,30 +1583,30 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\setupmarkdown[fencedCode = yes] -\starttext - -\startmarkdown - - A paragraph. - ``` - A fenced code. - ```\stopmarkdown - -\setupmarkdown[blankBeforeCodeFence = yes] -\startmarkdown - - A paragraph. - ``` - Not a fenced code. - ```\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\setupmarkdown[fencedCode = yes] +\starttext + +\startmarkdown + + A paragraph. + ``` + A fenced code. + ```\stopmarkdown + +\setupmarkdown[blankBeforeCodeFence = yes] +\startmarkdown + + A paragraph. + ``` + Not a fenced code. + ```\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1643,31 +1638,31 @@ div. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[fencedDivs]{markdown} -\begin{document} - -\begin{markdown} - - A paragraph. - - ::: {.identifier} - A fenced div. - :::\end{markdown} - -\begin{markdown*}{blankBeforeDivFence} - - A paragraph. - - ::: {.identifier} - Not a fenced div. - :::\end{markdown*} - -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage[fencedDivs]{markdown} +\begin{document} + +\begin{markdown} + + A paragraph. + + ::: {.identifier} + A fenced div. + :::\end{markdown} + +\begin{markdown*}{blankBeforeDivFence} + + A paragraph. + + ::: {.identifier} + Not a fenced div. + :::\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1700,30 +1695,30 @@ header.Lua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\def\markdownRendererHeadingOne#1{{\bf #1}\par} -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new() - input = "A paragraph." .. newline .. - "A heading." .. newline .. - "==========" .. newline - tex.sprint(convert(input)) - - convert = markdown.new({blankBeforeHeading = true}) - input = "A paragraph." .. newline .. - "Not a heading." .. newline .. - "==============" .. newline - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\def\markdownRendererHeadingOne#1{{\bf #1}\par} +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert, input + + convert = markdown.new() + input = "A paragraph." .. newline .. + "A heading." .. newline .. + "==========" .. newline + tex.sprint(convert(input)) + + convert = markdown.new({blankBeforeHeading = true}) + input = "A paragraph." .. newline .. + "Not a heading." .. newline .. + "==============" .. newline + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1734,23 +1729,23 @@ contain the following text:Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+- A paragraph. - A heading?==========
+ A paragraph. + A heading?==========
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ blankBeforeHeading=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ blankBeforeHeading=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -1771,26 +1766,26 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\markdownBegin - - A paragraph. - A heading. - ==========\markdownEnd - -\def\markdownOptionBlankBeforeHeading{true} -\markdownBegin - - A paragraph. - Not a heading. - ==============\markdownEnd - -\bye
\input markdown + +\markdownBegin + + A paragraph. + A heading. + ==========\markdownEnd + +\def\markdownOptionBlankBeforeHeading{true} +\markdownBegin + + A paragraph. + Not a heading. + ==============\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1802,27 +1797,27 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - A paragraph. - A heading. - ==========\end{markdown} - -\begin{markdown*}{blankBeforeHeading} - - A paragraph. - Not a heading. - ==============\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + A paragraph. + A heading. + ==========\end{markdown} + +\begin{markdown*}{blankBeforeHeading} + + A paragraph. + Not a heading. + ==============\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1834,29 +1829,29 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\starttext - -\startmarkdown - - A paragraph. - A heading. - ==========\stopmarkdown - -\setupmarkdown[blankBeforeHeading = yes] -\startmarkdown - - A paragraph. - Not a heading. - ==============\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
--context document.tex
A PDF document named
+document.pdf
should be produced and -contain the following text:+\usemodule[t][markdown] +\starttext + +\startmarkdown + + A paragraph. + A heading. + ==========\stopmarkdown + +\setupmarkdown[blankBeforeHeading = yes] +\startmarkdown + + A paragraph. + Not a heading. + ==============\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
++context document.tex
A PDF document named
document.pdf
should be produced and +contain the following text:A paragraph.
A heading.
@@ -1874,8 +1869,8 @@ class="header-section-number">2.2.1.9 OptionEnable the Pandoc bracketed span syntax extension:
-+[This is *some text*]{.class key=val}
@@ -1892,44 +1887,44 @@ class="sourceCode md">[This is *some text*]{.class key=val}
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[bracketedSpans]{markdown} -\usepackage{expl3} -\ExplSyntaxOn -\markdownSetup{ - - renderers = { - bracketedSpanAttributeContextBegin = {\group_begin: - \color_group_begin: - \markdownSetup{ - - renderers = { - attributeKeyValue = {\str_if_eq:nnT - - { ##1 } - { color } - {\color_select:n { ##2 } - - } - }, - }, - } - }, - bracketedSpanAttributeContextEnd = {\color_group_end: - \group_end: - - }, - }, - }\ExplSyntaxOff -\begin{document} -\begin{markdown} - - Here is some [colored text]{color=red}.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[bracketedSpans]{markdown} +\usepackage{expl3} +\ExplSyntaxOn +\markdownSetup{ + + renderers = { + bracketedSpanAttributeContextBegin = {\group_begin: + \color_group_begin: + \markdownSetup{ + + renderers = { + attributeKeyValue = {\str_if_eq:nnT + + { ##1 } + { color } + {\color_select:n { ##2 } + + } + }, + }, + } + }, + bracketedSpanAttributeContextEnd = {\color_group_end: + \group_end: + + }, + }, + }\ExplSyntaxOff +\begin{document} +\begin{markdown} + + Here is some [colored text]{color=red}.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1957,28 +1952,28 @@ class="header-section-number">2.2.1.10 OptionLua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\def\markdownRendererHeadingOne#1{{\bf #1}\par} -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new() - input = "> A single" .. newline .. newline .. - "> block quote." .. newline - tex.sprint(convert(input)) - - convert = markdown.new({breakableBlockquotes = true}) - input = "> A block quote." .. newline .. newline .. - "> Another block quote." .. newline - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\def\markdownRendererHeadingOne#1{{\bf #1}\par} +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert, input + + convert = markdown.new() + input = "> A single" .. newline .. newline .. + "> block quote." .. newline + tex.sprint(convert(input)) + + convert = markdown.new({breakableBlockquotes = true}) + input = "> A block quote." .. newline .. newline .. + "> Another block quote." .. newline + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1995,23 +1990,23 @@ contain the following text:Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+> A single block quote - -> or two block quotes?
> A single block quote + +> or two block quotes?
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ breakableBlockquotes=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ breakableBlockquotes=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -2038,26 +2033,26 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\markdownBegin - - > A single - - > block quote.\markdownEnd - -\def\markdownOptionBreakableBlockquotes{true} -\markdownBegin - - > A block quote. - - > Another block quote.\markdownEnd - -\bye
\input markdown + +\markdownBegin + + > A single + + > block quote.\markdownEnd + +\def\markdownOptionBreakableBlockquotes{true} +\markdownBegin + + > A block quote. + + > Another block quote.\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2075,27 +2070,27 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - > A single - - > block quote.\end{markdown} - -\begin{markdown*}{breakableBlockquotes} - - > A block quote. - - > Another block quote.\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + > A single + + > block quote.\end{markdown} + +\begin{markdown*}{breakableBlockquotes} + + > A block quote. + + > Another block quote.\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2113,27 +2108,27 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\starttext - -\startmarkdown - - > A single - - > block quote.\stopmarkdown - -\setupmarkdown[breakableBlockquotes = yes] -\startmarkdown - - > A block quote. - - > Another block quote.\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\starttext + +\startmarkdown + + > A single + + > block quote.\stopmarkdown + +\setupmarkdown[breakableBlockquotes = yes] +\startmarkdown + + > A block quote. + + > Another block quote.\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2173,37 +2168,37 @@ syntax extension. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.bib
with the following content:+@book{knuth:tex, -author = "Knuth, Donald Ervin", - title = "The \TeX book, volume A of Computers and typesetting", - publisher = "Addison-Wesley", - year = "1984" - }
@book{knuth:tex, +author = "Knuth, Donald Ervin", + title = "The \TeX book, volume A of Computers and typesetting", + publisher = "Addison-Wesley", + year = "1984" + }
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[citations]{markdown} -\begin{document} - -\begin{markdown} - - The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} - -\begin{markdown*}{citationNbsps = false} - - The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown*} - -\bibliographystyle{plain} -\bibliography{document.bib} -\end{document}
\documentclass{article} +\usepackage[citations]{markdown} +\begin{document} + +\begin{markdown} + + The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} + +\begin{markdown*}{citationNbsps = false} + + The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown*} + +\bibliographystyle{plain} +\bibliography{document.bib} +\end{document}
Next, invoke LuaTeX and BibTeX from the terminal:
-+lualatex document.tex -bibtex document.aux -lualatex document.tex -lualatex document.tex
lualatex document.tex +bibtex document.aux +lualatex document.tex +lualatex document.tex
A PDF document named
@@ -2228,20 +2223,20 @@ class="header-section-number">2.2.1.12 Optiondocument.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:Enable the Pandoc citation syntax extension:
-+[@doe99] and here - Here is a simple parenthetical citation - is a string of several [see @doe99, pp. 33-35; also - @smith04, chap. 1]. -[prenote @doe99] and - A parenthetical citation can have a [@smith04 postnote]. The name of the author can be - a - suppressed by inserting a dash before the name of an[-@smith04]. - author as follows - - Here is a simple text citation @doe99 and here is - a string of several @doe99 [pp. 33-35; also @smith04, - chap. 1]. Here is one with the name of the author suppressed -@doe99.
@@ -2258,34 +2253,34 @@ class="sourceCode md">[@doe99] and here + Here is a simple parenthetical citation + is a string of several [see @doe99, pp. 33-35; also + @smith04, chap. 1]. +[prenote @doe99] and + A parenthetical citation can have a [@smith04 postnote]. The name of the author can be + a + suppressed by inserting a dash before the name of an[-@smith04]. + author as follows + + Here is a simple text citation @doe99 and here is + a string of several @doe99 [pp. 33-35; also @smith04, + chap. 1]. Here is one with the name of the author suppressed -@doe99.
LaTeX Example
Using a text editor, create a text document named
-document.bib
with the following content:+@book{knuth:tex, -author = "Knuth, Donald Ervin", - title = "The \TeX book, volume A of Computers and typesetting", - publisher = "Addison-Wesley", - year = "1984" - }
@book{knuth:tex, +author = "Knuth, Donald Ervin", + title = "The \TeX book, volume A of Computers and typesetting", + publisher = "Addison-Wesley", + year = "1984" + }
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[backend=biber]{biblatex} -\addbibresource{document.bib} -\usepackage[citations]{markdown} -\begin{document} - -\begin{markdown} - - The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex.\end{markdown} - -\printbibliography -\end{document}
\documentclass{article} +\usepackage[backend=biber]{biblatex} +\addbibresource{document.bib} +\usepackage[citations]{markdown} +\begin{document} + +\begin{markdown} + + The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex.\end{markdown} + +\printbibliography +\end{document}
Next, invoke LuaTeX and Biber from the terminal:
-+lualatex document.tex -biber document.bcf -lualatex document.tex -lualatex document.tex
lualatex document.tex +biber document.bcf +lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2307,9 +2302,9 @@ class="header-section-number">2.2.1.13 Optiontrue @@ -2327,28 +2322,28 @@ quotation mark ligatures in texts that do not contain code spans: Enable the code span syntax:
-+`printf()` function. - Use the `There is a literal backtick (`) here.`` `
`printf()` function. + Use the `There is a literal backtick (`) here.`` `
Lua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new() - local input = - "``This is a code span.'' " .. - "``This is no longer a code span.''" - tex.sprint(convert(input)) }\par -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new({codeSpans = false}) - local input = - "``This is a quote.'' " .. - "``This is another quote.''" - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new() + local input = + "``This is a code span.'' " .. + "``This is no longer a code span.''" + tex.sprint(convert(input)) }\par +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new({codeSpans = false}) + local input = + "``This is a quote.'' " .. + "``This is another quote.''" + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2359,22 +2354,22 @@ span.’’Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\par -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+``Is this a code span?'' ``Or a quote?''
``Is this a code span?'' ``Or a quote?''
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ codeSpans=false -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ codeSpans=false -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -2394,24 +2389,24 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\markdownBegin - - ``This is a code span.'' - ``This is no longer a code span.''\markdownEnd - -\def\markdownOptionCodeSpans{false} -\markdownBegin - - ``This is a quote.'' - ``This is another quote.''\markdownEnd - -\bye
\input markdown + +\markdownBegin + + ``This is a code span.'' + ``This is no longer a code span.''\markdownEnd + +\def\markdownOptionCodeSpans{false} +\markdownBegin + + ``This is a quote.'' + ``This is another quote.''\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2423,25 +2418,25 @@ span.’’ class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - ``This is a code span.'' - ``This is no longer a code span.''\end{markdown} - -\begin{markdown*}{codeSpans=false} - - ``This is a quote.'' - ``This is another quote.''\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + ``This is a code span.'' + ``This is no longer a code span.''\end{markdown} + +\begin{markdown*}{codeSpans=false} + + ``This is a quote.'' + ``This is another quote.''\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2453,25 +2448,25 @@ span.’’ class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\starttext - -\startmarkdown - - ``This is a code span.'' - ``This is no longer a code span.''\stopmarkdown - -\setupmarkdown[codeSpans = no] -\startmarkdown - - ``This is a quote.'' - ``This is another quote.''\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\starttext + +\startmarkdown + + ``This is a code span.'' + ``This is no longer a code span.''\stopmarkdown + +\setupmarkdown[codeSpans = no] +\startmarkdown + + ``This is a quote.'' + ``This is another quote.''\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2489,13 +2484,13 @@ class="header-section-number">2.2.1.14 Optiontrue @@ -2518,34 +2513,34 @@ Marie,Curie,1867 Thomas,Edison,1847 Enable the iA Writer content blocks syntax extension:
-+- http://example.com/minard.jpg (Napoleon's - disastrous Russian campaign of 1812) - /Flowchart.png "Engineering Flowchart" - /Savings Account.csv 'Recent Transactions' - /Example.swift /Lorem Ipsum.txt
+ http://example.com/minard.jpg (Napoleon's + disastrous Russian campaign of 1812) + /Flowchart.png "Engineering Flowchart" + /Savings Account.csv 'Recent Transactions' + /Example.swift /Lorem Ipsum.txt
Create also a text document named
-markdown-languages.json
with the following content:+- {"tex": "LaTeX" - }
+ {"tex": "LaTeX" + }
Create also a text document named
-code.tex
with the following content:+\LaTeX. This is an example code listing in
\LaTeX. This is an example code listing in
Create also a text document named
-part.md
with the following content:+This is a *transcluded markdown document*.
This is a *transcluded markdown document*.
Create also a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{minted} -\usepackage[contentBlocks]{markdown} -\begin{document} -\begin{markdown} - - /table.csv (An example table) - /code.tex (An example code listing) - /part.md (A file transclusion example)\end{markdown} -\end{document}
\documentclass{article} +\usepackage{minted} +\usepackage[contentBlocks]{markdown} +\begin{document} +\begin{markdown} + + /table.csv (An example table) + /code.tex (An example code listing) + /part.md (A file transclusion example)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2576,8 +2571,8 @@ contain the following text:Table 1: An example table
-+\LaTeX. This is an example code listing in
\LaTeX. This is an example code listing in
This is a transcluded markdown document.
Con
Create also a text document named
-markdown-languages.json
with the following content:+- {"tex": "ConTeXt" - }
+ {"tex": "ConTeXt" + }
Create also a text document named
-code.tex
with the following content:+\ConTeXt. This is an example code listing in
\ConTeXt. This is an example code listing in
Create also a text document named
-part.md
with the following content:+This is a *transcluded markdown document*.
This is a *transcluded markdown document*.
Create also a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[contentBlocks = yes] -\definetyping [ConTeXt] -\setuptyping [ConTeXt] [option=TEX] -\starttext -\startmarkdown - - /table.csv (An example table) - /code.tex (An example code listing) - /part.md (A file transclusion example)\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[contentBlocks = yes] +\definetyping [ConTeXt] +\setuptyping [ConTeXt] [option=TEX] +\starttext +\startmarkdown + + /table.csv (An example table) + /code.tex (An example code listing) + /part.md (A file transclusion example)\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2649,8 +2644,8 @@ contain the following text:Table 1: An example table
-+\ConTeXt. This is an example code listing in
\ConTeXt. This is an example code listing in
This is a transcluded markdown document.
class="latex">LaTeX Example
Using a text editor, create a text document named
-strike-through.lua
with the following content:+local strike_through = { -= 2, - api_version = 2, - grammar_version = function(reader) - finalize_grammar local nonspacechar = lpeg.P(1) - lpeg.S("\t ") - local doubleslashes = lpeg.P("//") - local function between(p, starter, ender) - = lpeg.B(nonspacechar) * ender - ender return (starter * #nonspacechar - * lpeg.Ct(p * (p - ender)^0) * ender) - end - -local read_strike_through = between( - .V("Inline"), doubleslashes, doubleslashes - lpeg) / function(s) return {"\\st{", s, "}"} end - -.insert_pattern("Inline after Emph", read_strike_through, - reader"StrikeThrough") - .add_special_character("/") - readerend - } - -return strike_through
local strike_through = { += 2, + api_version = 2, + grammar_version = function(reader) + finalize_grammar local nonspacechar = lpeg.P(1) - lpeg.S("\t ") + local doubleslashes = lpeg.P("//") + local function between(p, starter, ender) + = lpeg.B(nonspacechar) * ender + ender return (starter * #nonspacechar + * lpeg.Ct(p * (p - ender)^0) * ender) + end + +local read_strike_through = between( + .V("Inline"), doubleslashes, doubleslashes + lpeg) / function(s) return {"\\st{", s, "}"} end + +.insert_pattern("Inline after Emph", read_strike_through, + reader"StrikeThrough") + .add_special_character("/") + readerend + } + +return strike_through
Using a text editor, create also a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{soul} -\usepackage[extension = strike-through.lua, -markdown} - debugExtensions]{\begin{document} -\begin{markdown} - - This is //a lunar roving vehicle// strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{soul} +\usepackage[extension = strike-through.lua, +markdown} + debugExtensions]{\begin{document} +\begin{markdown} + + This is //a lunar roving vehicle// strike-through text.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2736,40 +2731,40 @@ contain the following text:Furthermore, a JSON document named
-document.debug-extensions.json
should also be produced and contain the following text:+{ -"Block": [ - "Blockquote", - "Verbatim", - "ThematicBreak", - "BulletList", - "OrderedList", - "Heading", - "DisplayHtml", - "Paragraph", - "Plain" - ], - "Inline": [ - "Str", - "Space", - "Endline", - "UlOrStarLine", - "Strong", - "Emph", - "StrikeThrough (user-defined \"./strike-through.lua\" syntax extension)", - "Link", - "Image", - "Code", - "AutoLinkUrl", - "AutoLinkEmail", - "AutoLinkRelativeReference", - "InlineHtml", - "HtmlEntity", - "EscapedChar", - "Smart", - "Symbol" - ] - }
{ +"Block": [ + "Blockquote", + "Verbatim", + "ThematicBreak", + "BulletList", + "OrderedList", + "Heading", + "DisplayHtml", + "Paragraph", + "Plain" + ], + "Inline": [ + "Str", + "Space", + "Endline", + "UlOrStarLine", + "Strong", + "Emph", + "StrikeThrough (user-defined \"./strike-through.lua\" syntax extension)", + "Link", + "Image", + "Code", + "AutoLinkUrl", + "AutoLinkEmail", + "AutoLinkRelativeReference", + "InlineHtml", + "HtmlEntity", + "EscapedChar", + "Smart", + "Symbol" + ] + }
This output shows us that our user-defined syntax extension has been correctly inserted to the grammar of markdown.
2.2.1.16 Option
true @@ -2811,27 +2806,27 @@ class="sourceCode md"> Enable the pandoc definition list syntax extension:
-+- Term 1 - - : Definition 1 - - Term 2 with *inline markup* - - : Definition 2 - { some code, part of Definition 2 } - - Third paragraph of definition 2.
+ Term 1 + + : Definition 1 + + Term 2 with *inline markup* + + : Definition 2 + { some code, part of Definition 2 } + + Third paragraph of definition 2.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[definitionLists]{markdown} -\begin{document} -\begin{markdown} - - Term 1 - - : Definition 1 - - Term 2 with *inline markup* - - : Definition 2 - - { some code, part of Definition 2 } - - Third paragraph of definition 2.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[definitionLists]{markdown} +\begin{document} +\begin{markdown} + + Term 1 + + : Definition 1 + + Term 2 with *inline markup* + + : Definition 2 + + { some code, part of Definition 2 } + + Third paragraph of definition 2.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2852,27 +2847,27 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\setupmarkdown[definitionLists = yes] -\starttext -\startmarkdown - - Term 1 - - : Definition 1 - - Term 2 with *inline markup* - - : Definition 2 - - { some code, part of Definition 2 } - - Third paragraph of definition 2.\stopmarkdown -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\setupmarkdown[definitionLists = yes] +\starttext +\startmarkdown + + Term 1 + + : Definition 1 + + Term 2 with *inline markup* + + : Definition 2 + + { some code, part of Definition 2 } + + Third paragraph of definition 2.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2927,12 +2922,12 @@ wheneagerCache
is disabled.Lua Module Example
Using a text editor, create a text document named
-hello.md
with the following content:+Hello *world*!
Hello *world*!
Next, invoke LuaTeX from the terminal with the
-eagerCache
option disabled:+texlua ⟨CLI pathname⟩ eagerCache=false -- hello.md hello.tex
texlua ⟨CLI pathname⟩ eagerCache=false -- hello.md hello.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -2945,23 +2940,23 @@ title="Kpathsea - TeX Users Group">Kpathsea.A TeX document named
-hello.tex
should be produced and contain the following code:+\markdownRendererEmphasis{world}!\relax Hello
\markdownRendererEmphasis{world}!\relax Hello
Invoke LuaTeX from the terminal again, this time with the
-eagerCache
option enabled:+texlua ⟨CLI pathname⟩ eagerCache=true -- hello.md hello.tex
texlua ⟨CLI pathname⟩ eagerCache=true -- hello.md hello.tex
A TeX document named
-hello.tex
should be produced and contain the following code:+\input ./⟨hash⟩.md.tex\relax
\input ./⟨hash⟩.md.tex\relax
Additionally, a TeX document named
-⟨hash⟩.md.tex
should be produced and contain the following code:+\markdownRendererEmphasis{world}!\relax Hello
\markdownRendererEmphasis{world}!\relax Hello
2.2.1.18 Option
@@ -2977,26 +2972,26 @@ then a markdown document may begin with yaml metadata if and only if the metadata begin with the end-of-directives marker (expectJekyllData
---
) and they end with either the end-of-directives or the end-of-document marker (...
): -+\documentclass{article} -\usepackage[jekyllData]{markdown} -\begin{document} -\begin{markdown} - - --- - - this - - is - - YAML - ... - - followed - - by - - Markdown\end{markdown} -\begin{markdown} - - - this - - is - - Markdown\end{markdown} -\end{document}
@@ -3007,25 +3002,25 @@ class="sourceCode latex">\documentclass{article} +\usepackage[jekyllData]{markdown} +\begin{document} +\begin{markdown} + + --- + - this + - is + - YAML + ... + - followed + - by + - Markdown\end{markdown} +\begin{markdown} + + - this + - is + - Markdown\end{markdown} +\end{document}
When the
jekyllData
option is enabled, then a markdown document may begin directly with yaml metadata and may contain nothing but yaml metadata. -+\documentclass{article} -\usepackage[jekyllData, expectJekyllData]{markdown} -\begin{document} -\begin{markdown} - - - this - - is - - YAML - ... - - followed - - by - - Markdown\end{markdown} -\begin{markdown} - - - this - - is - - YAML\end{markdown} -\end{document}
@@ -3034,29 +3029,29 @@ class="sourceCode latex">\documentclass{article} +\usepackage[jekyllData, expectJekyllData]{markdown} +\begin{document} +\begin{markdown} + + - this + - is + - YAML + ... + - followed + - by + - Markdown\end{markdown} +\begin{markdown} + + - this + - is + - YAML\end{markdown} +\end{document}
LaTeX Example
directory structure. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-jane-doe.yml
with the following content:+name: Jane Doe -age: 99
name: Jane Doe +age: 99
Using a text editor, create also a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - jekyllDataRenderers = {\gdef\name{#1}}, - name = {\gdef\age{#1}}, - code = { - }, - renderers = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} -\markdownInput[expectJekyllData]{jane-doe.yml} -\end{document}
\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + jekyllDataRenderers = {\gdef\name{#1}}, + name = {\gdef\age{#1}}, + code = { + }, + renderers = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\begin{document} +\markdownInput[expectJekyllData]{jane-doe.yml} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3079,44 +3074,44 @@ class="tex">TeXUsing a text editor, create a text document named
-strike-through.lua
with the following content:+local strike_through = { -= 2, - api_version = 2, - grammar_version = function(reader) - finalize_grammar local nonspacechar = lpeg.P(1) - lpeg.S("\t ") - local doubleslashes = lpeg.P("//") - local function between(p, starter, ender) - = lpeg.B(nonspacechar) * ender - ender return (starter * #nonspacechar - * lpeg.Ct(p * (p - ender)^0) * ender) - end - -local read_strike_through = between( - .V("Inline"), doubleslashes, doubleslashes - lpeg) / function(s) return {"\\st{", s, "}"} end - -.insert_pattern("Inline after Emph", read_strike_through, - reader"StrikeThrough") - .add_special_character("/") - readerend - } - -return strike_through
local strike_through = { += 2, + api_version = 2, + grammar_version = function(reader) + finalize_grammar local nonspacechar = lpeg.P(1) - lpeg.S("\t ") + local doubleslashes = lpeg.P("//") + local function between(p, starter, ender) + = lpeg.B(nonspacechar) * ender + ender return (starter * #nonspacechar + * lpeg.Ct(p * (p - ender)^0) * ender) + end + +local read_strike_through = between( + .V("Inline"), doubleslashes, doubleslashes + lpeg) / function(s) return {"\\st{", s, "}"} end + +.insert_pattern("Inline after Emph", read_strike_through, + reader"StrikeThrough") + .add_special_character("/") + readerend + } + +return strike_through
Using a text editor, create also a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{soul} -\usepackage[extension = strike-through.lua]{markdown} -\begin{document} -\begin{markdown} - - This is //a lunar roving vehicle// strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{soul} +\usepackage[extension = strike-through.lua]{markdown} +\begin{document} +\begin{markdown} + + This is //a lunar roving vehicle// strike-through text.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3134,10 +3129,10 @@ class="header-section-number">2.2.1.20 OptionEnable the Pandoc fancy list syntax extension:
-+- a) first item - b) second item c) third item
@@ -3154,20 +3149,20 @@ class="sourceCode md">+ a) first item + b) second item c) third item
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{minted} -\usepackage[fancyLists]{markdown} -\begin{document} -\begin{markdown} - - a) first item - b) second item - c) third item\end{markdown} -\end{document}
\documentclass{article} +\usepackage{minted} +\usepackage[fancyLists]{markdown} +\begin{document} +\begin{markdown} + + a) first item + b) second item + c) third item\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3181,19 +3176,19 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[fancyLists = yes] -\starttext -\startmarkdown - - a) first item - b) second item - c) third item\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[fancyLists = yes] +\starttext +\startmarkdown + + a) first item + b) second item + c) third item\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3213,23 +3208,23 @@ class="header-section-number">2.2.1.21 Optiontrue @@ -3246,99 +3241,99 @@ class="sourceCode md"> Enable the commonmark fenced code block extension:
-+~~~ js -if (a > 3) { -moveShip(5 * gravity, DOWN); - - }~~~~~~ - -``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ```
~~~ js +if (a > 3) { +moveShip(5 * gravity, DOWN); + + }~~~~~~ + +``` html + <pre> + <code> + // Some comments + line 1 of code + line 2 of code + line 3 of code + </code> + </pre> + ```
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{minted} -\usepackage[fencedCode]{markdown} -\begin{document} -\begin{markdown} - - ~~~ js - if (a > 3) { - moveShip(5 * gravity, DOWN); - } - ~~~~~~ - - ``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage{minted} +\usepackage[fencedCode]{markdown} +\begin{document} +\begin{markdown} + + ~~~ js + if (a > 3) { + moveShip(5 * gravity, DOWN); + } + ~~~~~~ + + ``` html + <pre> + <code> + // Some comments + line 1 of code + line 2 of code + line 3 of code + </code> + </pre> + ```\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:--if (a > 3) { -moveShip(5 * gravity, DOWN); - }
+<pre> -<code> - - // Some comments - line 1 of code - line 2 of code - line 3 of code</code> - </pre>
+if (a > 3) { +moveShip(5 * gravity, DOWN); + }
<pre> +<code> + + // Some comments + line 1 of code + line 2 of code + line 3 of code</code> + </pre>
ConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[fencedCode = yes] -\definetyping [js] -\definetyping [html] -\setuptyping [html] [option=XML] -\starttext -\startmarkdown - - ~~~ js - if (a > 3) { - moveShip(5 * gravity, DOWN); - } - ~~~~~~ - - ``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ```\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[fencedCode = yes] +\definetyping [js] +\definetyping [html] +\setuptyping [html] [option=XML] +\starttext +\startmarkdown + + ~~~ js + if (a > 3) { + moveShip(5 * gravity, DOWN); + } + ~~~~~~ + + ``` html + <pre> + <code> + // Some comments + line 1 of code + line 2 of code + line 3 of code + </code> + </pre> + ```\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:--if (a > 3) { -moveShip(5 * gravity, DOWN); - }
+<pre> -<code> - - // Some comments - line 1 of code - line 2 of code - line 3 of code</code> - </pre>
+if (a > 3) { +moveShip(5 * gravity, DOWN); + }
<pre> +<code> + + // Some comments + line 1 of code + line 2 of code + line 3 of code</code> + </pre>
2.2.1.22 Option @@ -3353,12 +3348,12 @@ class="header-section-number">2.2.1.22 Option
Enable the Pandoc fenced code attribute syntax extension:
-+~~~~ {#mycode .haskell .numberLines startFrom=100} -qsort [] = [] -qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ - qsort (filter (>= x) xs) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -3375,40 +3370,40 @@ class="sourceCode md">~~~~ {#mycode .haskell .numberLines startFrom=100} +qsort [] = [] +qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ + qsort (filter (>= x) xs) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[fencedCode, -markdown} - fencedCodeAttributes]{\usepackage{minted} -\markdownSetup{ - - renderers = {% - fencedCodeAttributeContextBegin = {\begingroup - \markdownSetup{ - - renderers = {% - attributeKeyValue = {\setminted{{#1} = {#2}}% - - }, - },% - } - },% - fencedCodeAttributeContextEnd = {\endgroup - - }, - }, - }\begin{document} -\begin{markdown} - - ~~~ js {linenos=true} - if (a > 3) { - moveShip(5 * gravity, DOWN); - } - ~~~~~~\end{markdown} -\end{document}
\documentclass{article} +\usepackage[fencedCode, +markdown} + fencedCodeAttributes]{\usepackage{minted} +\markdownSetup{ + + renderers = {% + fencedCodeAttributeContextBegin = {\begingroup + \markdownSetup{ + + renderers = {% + attributeKeyValue = {\setminted{{#1} = {#2}}% + + }, + },% + } + },% + fencedCodeAttributeContextEnd = {\endgroup + + }, + }, + }\begin{document} +\begin{markdown} + + ~~~ js {linenos=true} + if (a > 3) { + moveShip(5 * gravity, DOWN); + } + ~~~~~~\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3427,12 +3422,12 @@ class="header-section-number">2.2.1.23 OptionEnable the Pandoc fenced div syntax extension:
-+- ::::: {#special .sidebar} - Here is a paragraph. - - And another. :::::
@@ -3449,23 +3444,23 @@ class="sourceCode md">+ ::::: {#special .sidebar} + Here is a paragraph. + + And another. :::::
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[fencedDivs]{markdown} -\begin{document} -\begin{markdown}{slice=special} - - Here is a regular paragraph. - - ::::: {#special} - Here is a special paragraph. - ::::: - - And here is another regular paragraph.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[fencedDivs]{markdown} +\begin{document} +\begin{markdown}{slice=special} + + Here is a regular paragraph. + + ::::: {#special} + Here is a special paragraph. + ::::: + + And here is another regular paragraph.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3495,31 +3490,31 @@ not be reflected. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionFinalizeCache{true} -\markdownBegin - - Hello *world*!\markdownEnd -\bye
\input markdown +\def\markdownOptionFinalizeCache{true} +\markdownBegin + + Hello *world*!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!” A frozen cache will also be produced as we requested using thefinalizeCache
option.Next, change the content of
-document.tex
as follows:+\input markdown -\def\markdownOptionFrozenCache{true} -\markdownBegin - - Hi *world*!\markdownEnd -\bye
\input markdown +\def\markdownOptionFrozenCache{true} +\markdownBegin + + Hi *world*!\markdownEnd +\bye
Last, invoke pdfTeX without shell access from the terminal:
-+pdftex -no-shell-escape document.tex
pdftex -no-shell-escape document.tex
A new PDF document named
document.pdf
should be produced and contain the same text “Hello world!” Since we used the contents of the frozen cache using the @@ -3531,33 +3526,33 @@ in the content of the markdown document from “Hello world!” to class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass[finalizecache]{article} -\usepackage{markdown} -\begin{document} -\begin{markdown} - - Hello *world*!\end{markdown} -\end{document}
\documentclass[finalizecache]{article} +\usepackage{markdown} +\begin{document} +\begin{markdown} + + Hello *world*!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!” A frozen cache will also be produced as we requested using thefinalizecache
option.Next, change the content of
-document.tex
as follows:+\documentclass[frozencache]{article} -\usepackage{markdown} -\begin{document} -\begin{markdown} - - Hi *world*!\end{markdown} -\end{document}
\documentclass[frozencache]{article} +\usepackage{markdown} +\begin{document} +\begin{markdown} + + Hi *world*!\end{markdown} +\end{document}
Last, invoke pdfTeX without shell access from the terminal:
-+pdflatex -no-shell-escape document.tex
pdflatex -no-shell-escape document.tex
A new PDF document named
document.pdf
should be produced and contain the same text “Hello world!” Since we used the contents of the frozen cache using the @@ -3569,33 +3564,33 @@ in the content of the markdown document from “Hello world!” to class="tex">TeXt ExampleUsing a text editor, create a text document named
+document.tex
with the following content:+\usemodule[t][markdown] +\setupmarkdown[finalizeCache = yes] +\starttext +\startmarkdown + + Hello *world*!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
++context document.tex
A PDF document named
+document.pdf
should be produced and +contain the text “Hello world!” A frozen cache will also be +produced in thecache.tex
output file as we requested using +thefinalizeCache
option.Next, change the content of
document.tex
as follows:-\usemodule[t][markdown] -\setupmarkdown[finalizeCache = yes] +\setupmarkdown[frozenCache = yes] \starttext \startmarkdown - + Hello *world*! Hi *world*!\stopmarkdown \stoptext
Next, invoke LuaTeX from the terminal:
+Last, invoke pdfTeX without shell access from the terminal:
-context document.tex
A PDF document named
-document.pdf
should be produced and -contain the text “Hello world!” A frozen cache will also be -produced in thecache.tex
output file as we requested using -thefinalizeCache
option.Next, change the content of
-document.tex
as follows:-\usemodule[t][markdown] -\setupmarkdown[frozenCache = yes] -\starttext -\startmarkdown - - Hi *world*!\stopmarkdown -\stoptext
Last, invoke pdfTeX without shell access from the terminal:
-texexec --passon=--no-shell-escape document.tex
A new PDF document named
document.pdf
should be produced and contain the same text “Hello world!” Since we used the contents of the frozen cache using the @@ -3623,19 +3618,19 @@ markdown document number ⟨number⟩.Lua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\directlua{ - - local markdown = require("markdown") - local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0}) - local firstInput = "Hello" - local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1}) - local secondInput = "*world*!" - tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }\bye
\input markdown +\directlua{ + + local markdown = require("markdown") + local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0}) + local firstInput = "Hello" + local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1}) + local secondInput = "*world*!" + tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
class="latex">LaTeX Exampledocument.pdf
should be produced and contain the text “Hello world!” A frozen cache with two entries will also be produced as we requested using the @@ -3667,29 +3662,29 @@ of spaces.Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - 'Twas brillig, and the slithy toves - Did gyre and gimble in the wabe; - All mimsy were the borogoves, - And the mome raths outgrabe.\end{markdown} - -\begin{markdown*}{hardLineBreaks} - - 'Twas brillig, and the slithy toves - Did gyre and gimble in the wabe; - All mimsy were the borogoves, - And the mome raths outgrabe.\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + 'Twas brillig, and the slithy toves + Did gyre and gimble in the wabe; + All mimsy were the borogoves, + And the mome raths outgrabe.\end{markdown} + +\begin{markdown*}{hardLineBreaks} + + 'Twas brillig, and the slithy toves + Did gyre and gimble in the wabe; + All mimsy were the borogoves, + And the mome raths outgrabe.\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3710,10 +3705,10 @@ class="header-section-number">2.2.1.27 Option@@ -3731,27 +3726,27 @@ markers. class="latex">LaTeX Example Enable the use of hash symbols (
-#
) as ordered item list markers:+- #. Bird - #. McHale #. Parish
+ #. Bird + #. McHale #. Parish
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - #. Bird - #. McHale - #. Parish\end{markdown} - -\begin{markdown*}{hashEnumerators} - - #. Bird - #. McHale - #. Parish\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + #. Bird + #. McHale + #. Parish\end{markdown} + +\begin{markdown*}{hashEnumerators} + + #. Bird + #. McHale + #. Parish\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3768,27 +3763,27 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\starttext - -\startmarkdown - - #. Bird - #. McHale - #. Parish\stopmarkdown - -\setupmarkdown[hashEnumerators = yes] -\startmarkdown - - #. Bird - #. McHale - #. Parish\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\starttext + +\startmarkdown + + #. Bird + #. McHale + #. Parish\stopmarkdown + +\setupmarkdown[hashEnumerators = yes] +\startmarkdown + + #. Bird + #. McHale + #. Parish\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3812,13 +3807,13 @@ class="header-section-number">2.2.1.28 Optiontrue @@ -3861,33 +3856,33 @@ will be rendered as plain text. Enable the assignment of HTML attributes to headings:
-+# My first heading {#foo} - -## My second heading ## {#bar .baz} - - - Yet another heading {key=value}===================
# My first heading {#foo} + +## My second heading ## {#bar .baz} + + + Yet another heading {key=value}===================
Lua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new() - local newline = [[^^J^^J]] - local input = - "<div>*There is no block tag support.*</div>" .. newline .. - "*There is no <inline tag="tag"></inline> support.*" .. newline .. - "_There is no <!-- comment --> support._" .. newline .. - "_There is no <? HTML instruction ?> support._" - tex.sprint(convert(input)) }\par -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new({html = true}) - local input = - "<div>*There is block tag support.*</div>" .. newline .. - "*There is <inline tag="tag"></inline> support.*" .. newline .. - "_There is <!-- comment --> support._" .. newline .. - "_There is <? HTML instruction ?> support._" - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new() + local newline = [[^^J^^J]] + local input = + "<div>*There is no block tag support.*</div>" .. newline .. + "*There is no <inline tag="tag"></inline> support.*" .. newline .. + "_There is no <!-- comment --> support._" .. newline .. + "_There is no <? HTML instruction ?> support._" + tex.sprint(convert(input)) }\par +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new({html = true}) + local input = + "<div>*There is block tag support.*</div>" .. newline .. + "*There is <inline tag="tag"></inline> support.*" .. newline .. + "_There is <!-- comment --> support._" .. newline .. + "_There is <? HTML instruction ?> support._" + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3900,27 +3895,27 @@ support.Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\par -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+<div> - - *Is there block tag support?*</div> -<inline tag="tag"></inline> support?* - *Is there <!-- comment --> support?_ - _Is there <? HTML instruction ?> support?_ _Is there
<div> + + *Is there block tag support?*</div> +<inline tag="tag"></inline> support?* + *Is there <!-- comment --> support?_ + _Is there <? HTML instruction ?> support?_ _Is there
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -3942,33 +3937,73 @@ contain the following text:Using a text editor, create a text document named
+document.tex
with the following content:+\input markdown +\input lmfonts + +\markdownBegin + + <div> + *There is no block tag support.* + </div> + *There is no <inline tag="tag"></inline> support.* + _There is no <!-- comment --> support._ + _There is no <? HTML instruction ?> support._\markdownEnd + +\def\markdownOptionHtml{true} +\markdownBegin + + <div> + *There is block tag support.* + </div> + *There is <inline tag="tag"></inline> support.* + _There is <!-- comment --> support._ + _There is <? HTML instruction ?> support._\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
++luatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++<div>There is no block tag support.</div> There is no +<inline tag=”tag”></inline> support. There is no <!– +comment –> support. There is no <? HTML instruction ?> +support.
+There is support. There is support. There is support.
+LaTeX Example
+Using a text editor, create a text document named +
document.tex
with the following content:+\end{document}\input markdown -\input lmfonts - -\markdownBegin - - <div> - *There is no block tag support.* - </div> - *There is no <inline tag="tag"></inline> support.* - _There is no <!-- comment --> support._ - _There is no <? HTML instruction ?> support._\markdownEnd - -\def\markdownOptionHtml{true} -\markdownBegin +class="sourceCode tex">
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + <div> + *There is no block tag support.* + </div> + *There is no <inline tag="tag"></inline> support.* + _There is no <!-- comment --> support._ + _There is no <? HTML instruction ?> support._\end{markdown} + +\begin{markdown*}{html} <div> *There is block tag support.* </div> *There is <inline tag="tag"></inline> support.* _There is <!-- comment --> support._ - _There is <? HTML instruction ?> support._\markdownEnd +\end{markdown*} -\bye
Next, invoke LuaTeX from the terminal:
+class="sourceCode sh">luatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3978,77 +4013,37 @@ comment –> support. There is no <? HTML instruction ?> support.-There is support. There is support. There is support.
LaTeX Example
+ConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:+\stoptext\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - <div> - *There is no block tag support.* - </div> - *There is no <inline tag="tag"></inline> support.* - _There is no <!-- comment --> support._ - _There is no <? HTML instruction ?> support._\end{markdown} - -\begin{markdown*}{html} +class="sourceCode tex">
\usemodule[t][markdown] +\starttext + +\startmarkdown + + <div> + *There is no block tag support.* + </div> + *There is no <inline tag="tag"></inline> support.* + _There is no <!-- comment --> support._ + _There is no <? HTML instruction ?> support._\stopmarkdown + +\setupmarkdown[html = yes] +\startmarkdown <div> *There is block tag support.* </div> *There is <inline tag="tag"></inline> support.* _There is <!-- comment --> support._ - _There is <? HTML instruction ?> support._\end{markdown*} +\stopmarkdown -\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
A PDF document named
-document.pdf
should be produced and -contain the following text:--<div>There is no block tag support.</div> There is no -<inline tag=”tag”></inline> support. There is no <!– -comment –> support. There is no <? HTML instruction ?> -support.
-There is support. There is support. There is support.
-ConTeXt Example
-Using a text editor, create a text document named -
-document.tex
with the following content:-\usemodule[t][markdown] -\starttext - -\startmarkdown - - <div> - *There is no block tag support.* - </div> - *There is no <inline tag="tag"></inline> support.* - _There is no <!-- comment --> support._ - _There is no <? HTML instruction ?> support._\stopmarkdown - -\setupmarkdown[html = yes] -\startmarkdown - - <div> - *There is block tag support.* - </div> - *There is <inline tag="tag"></inline> support.* - _There is <!-- comment --> support._ - _There is <? HTML instruction ?> support._\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
-+class="sourceCode sh">context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4095,27 +4090,27 @@ prepared with this package in mind. ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local input, convert_safe, convert_unsafe, paragraph -$\string\sqrt{-1}$ *equals* $i$.]] - input = [[ - convert_safe = markdown.new() - convert_unsafe = markdown.new({hybrid = true})\par]] - paragraph = [[ - - tex.sprint( - convert_safe(input) .. paragraph .. - convert_unsafe(input) - ) - }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local input, convert_safe, convert_unsafe, paragraph +$\string\sqrt{-1}$ *equals* $i$.]] + input = [[ + convert_safe = markdown.new() + convert_unsafe = markdown.new({hybrid = true})\par]] + paragraph = [[ + + tex.sprint( + convert_safe(input) .. paragraph .. + convert_unsafe(input) + ) + }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4126,25 +4121,25 @@ contain the following text:Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse - -\begingroup -\catcode`\%=12 -\input optiontrue -\endgroup -\bye
\input markdown +\input lmfonts +\input optionfalse + +\begingroup +\catcode`\%=12 +\input optiontrue +\endgroup +\bye
Using a text editor, create a text document named
-content.md
with the following content:+$\sqrt{-1}$ *equals* $i$.
$\sqrt{-1}$ *equals* $i$.
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -4165,23 +4160,23 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts - -\markdownBegin -$\sqrt{-1}$ *equals* $i$. -\markdownEnd - -\def\markdownOptionHybrid{true} -\markdownBegin -$\sqrt{-1}$ *equals* $i$. -\markdownEnd - -\bye
\input markdown +\input lmfonts + +\markdownBegin +$\sqrt{-1}$ *equals* $i$. +\markdownEnd + +\def\markdownOptionHybrid{true} +\markdownBegin +$\sqrt{-1}$ *equals* $i$. +\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4193,23 +4188,23 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} -$\sqrt{-1}$ *equals* $i$. -\end{markdown} - -\begin{markdown*}{hybrid} -$\sqrt{-1}$ *equals* $i$. -\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} +$\sqrt{-1}$ *equals* $i$. +\end{markdown} + +\begin{markdown*}{hybrid} +$\sqrt{-1}$ *equals* $i$. +\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4221,23 +4216,23 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\starttext - -\startmarkdown -$\sqrt{-1}$ *equals* $i$. -\stopmarkdown - -\setupmarkdown[hybrid = yes] -\startmarkdown -$\sqrt{-1}$ *equals* $i$. -\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\starttext + +\startmarkdown +$\sqrt{-1}$ *equals* $i$. +\stopmarkdown + +\setupmarkdown[hybrid = yes] +\startmarkdown +$\sqrt{-1}$ *equals* $i$. +\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4258,8 +4253,8 @@ class="header-section-number">2.2.1.31 OptionEnable the Pandoc inline code span attribute extension:
-+`<$>`{.haskell}
@@ -4276,44 +4271,44 @@ class="sourceCode md">`<$>`{.haskell}
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[inlineCodeAttributes]{markdown} -\usepackage{expl3} -\ExplSyntaxOn -\markdownSetup{ - - renderers = { - codeSpanAttributeContextBegin = {\group_begin: - \color_group_begin: - \markdownSetup{ - - renderers = { - attributeKeyValue = {\str_if_eq:nnT - - { ##1 } - { color } - {\color_select:n { ##2 } - - } - }, - }, - } - }, - codeSpanAttributeContextEnd = {\color_group_end: - \group_end: - - }, - }, - }\ExplSyntaxOff -\begin{document} -\begin{markdown} - - Here is some `colored text`{color=red}.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[inlineCodeAttributes]{markdown} +\usepackage{expl3} +\ExplSyntaxOn +\markdownSetup{ + + renderers = { + codeSpanAttributeContextBegin = {\group_begin: + \color_group_begin: + \markdownSetup{ + + renderers = { + attributeKeyValue = {\str_if_eq:nnT + + { ##1 } + { color } + {\color_select:n { ##2 } + + } + }, + }, + } + }, + codeSpanAttributeContextEnd = {\color_group_end: + \group_end: + + }, + }, + }\ExplSyntaxOff +\begin{document} +\begin{markdown} + + Here is some `colored text`{color=red}.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4332,10 +4327,10 @@ class="header-section-number">2.2.1.32 OptionEnable the Pandoc inline note syntax extension:
-+- Here is an inline note.^[Inlines notes are easier to - write, since you don't have to pick an identifier and move down to type the note.]
@@ -4352,19 +4347,19 @@ class="sourceCode md">+ Here is an inline note.^[Inlines notes are easier to + write, since you don't have to pick an identifier and move down to type the note.]
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[inlineNotes]{markdown} -\begin{document} -\begin{markdown} - - Here is an inline note.^[Inlines notes are easier to - write, since you don't have to pick an identifier and - move down to type the note.]\end{markdown} -\end{document}
\documentclass{article} +\usepackage[inlineNotes]{markdown} +\begin{document} +\begin{markdown} + + Here is an inline note.^[Inlines notes are easier to + write, since you don't have to pick an identifier and + move down to type the note.]\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4375,19 +4370,19 @@ id="fnref1" role="doc-noteref">1 class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[inlineNotes = yes] -\starttext -\startmarkdown - - Here is an inline note.^[Inlines notes are easier to - write, since you don't have to pick an identifier and - move down to type the note.]\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[inlineNotes = yes] +\starttext +\startmarkdown + + Here is an inline note.^[Inlines notes are easier to + write, since you don't have to pick an identifier and + move down to type the note.]\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4407,18 +4402,18 @@ class="header-section-number">2.2.1.33 Option href="https://pandoc.org/MANUAL.html#extension-yaml_metadata_block">yaml metadata block syntax extension for entering metadata in yaml: -+--- -title: 'This is the title: it contains a colon' -author: -- Author One -- Author Two -keywords: [nothing, nothingness] -abstract: | - - This is the abstract. - - It consists of two paragraphs.---
@@ -4436,29 +4431,29 @@ for entering metadata in yaml. class="tex">TeX Example--- +title: 'This is the title: it contains a colon' +author: +- Author One +- Author Two +keywords: [nothing, nothingness] +abstract: | + + This is the abstract. + + It consists of two paragraphs.---
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionJekyllData{true} -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \markdownBegin - - --- - name: Jane Doe - age: 99 - ---\markdownEnd -\bye
\input markdown +\def\markdownOptionJekyllData{true} +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \markdownBegin + + --- + name: Jane Doe + age: 99 + ---\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4468,31 +4463,31 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - jekyllDataRenderers = {\gdef\name{#1}}, - name = {\gdef\age{#1}}, - code = { - }, - renderers = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + jekyllDataRenderers = {\gdef\name{#1}}, + name = {\gdef\age{#1}}, + code = { + }, + renderers = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\begin{document} + +\begin{markdown} + + --- + name: Jane Doe + age: 99 + ---\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4502,32 +4497,32 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[jekyllData = yes] -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \starttext - -\startmarkdown - - --- - name: Jane Doe - age: 99 - ---\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[jekyllData = yes] +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \starttext + +\startmarkdown + + --- + name: Jane Doe + age: 99 + ---\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4545,11 +4540,11 @@ class="header-section-number">2.2.1.34 OptionEnable the Pandoc link and image attribute syntax extension:
-+{#id .class width=30 height=20px} - An inline ![image][ref] with attributes. - and a reference -[ref]: foo.jpg "optional title" {#id .class key=val key2=val2}
@@ -4566,41 +4561,41 @@ class="sourceCode md">{#id .class width=30 height=20px} + An inline ![image][ref] with attributes. + and a reference +[ref]: foo.jpg "optional title" {#id .class key=val key2=val2}
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[linkAttributes]{markdown} -\usepackage{expl3, graphicx} -\ExplSyntaxOn -\markdownSetup{ - - renderers = { - imageAttributeContextBegin = {\group_begin: - \markdownSetup{ - - renderers = { - attributeKeyValue = {\setkeys - - { Gin } - { { ##1 } = { ##2 } } - }, - }, - } - }, - imageAttributeContextEnd = {\group_end: - - }, - }, - }\ExplSyntaxOff -\begin{document} -\begin{markdown} - - Here is an example image: - - {width=5cm height=4cm}\end{markdown} -\end{document}
\documentclass{article} +\usepackage[linkAttributes]{markdown} +\usepackage{expl3, graphicx} +\ExplSyntaxOn +\markdownSetup{ + + renderers = { + imageAttributeContextBegin = {\group_begin: + \markdownSetup{ + + renderers = { + attributeKeyValue = {\setkeys + + { Gin } + { { ##1 } = { ##2 } } + }, + }, + } + }, + imageAttributeContextEnd = {\group_end: + + }, + }, + }\ExplSyntaxOff +\begin{document} +\begin{markdown} + + Here is an example image: + + {width=5cm height=4cm}\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
class="tex">TeXt Exampledocument.pdf
should be produced and contain an example image (from Martin Scharrer’s mwe @@ -4617,12 +4612,12 @@ class="header-section-number">2.2.1.35 OptionEnable the Pandoc line block syntax extension:
-+- | this is a line block that - | spans multiple - | even - discontinuous | lines
@@ -4639,19 +4634,19 @@ class="sourceCode md">+ | this is a line block that + | spans multiple + | even + discontinuous | lines
TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionLineBlocks{true} -\markdownBegin - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\markdownEnd -\bye
\input markdown +\def\markdownOptionLineBlocks{true} +\markdownBegin + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4664,20 +4659,20 @@ Tread softly because you tread on my dreams. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[lineBlocks]{markdown} -\begin{document} -\begin{markdown} - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[lineBlocks]{markdown} +\begin{document} +\begin{markdown} + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4690,20 +4685,20 @@ Tread softly because you tread on my dreams. class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[lineBlocks = yes] -\starttext -\startmarkdown - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[lineBlocks = yes] +\starttext +\startmarkdown + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4724,24 +4719,24 @@ class="header-section-number">2.2.1.36 OptionEnable the Pandoc note syntax extension:
-+[^1] and another.[^longnote] - Here is a note reference, -[^1]: Here is the note. - -[^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they - - belong to the previous note. - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph notes - work like multi-paragraph list items. - - - This paragraph won't be part of the note, because it isn't indented.
@@ -4758,33 +4753,33 @@ class="sourceCode md">[^1] and another.[^longnote] + Here is a note reference, +[^1]: Here is the note. + +[^longnote]: Here's one with multiple blocks. + + Subsequent paragraphs are indented to show that they + + belong to the previous note. + { some.code } + + The whole paragraph can be indented, or just the + first line. In this way, multi-paragraph notes + work like multi-paragraph list items. + + + This paragraph won't be part of the note, because it isn't indented.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[notes]{markdown} -\begin{document} -\begin{markdown} - - Here is a note reference,[^1] and another.[^longnote] - - [^1]: Here is the note. - - [^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they - belong to the previous note. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph notes - work like multi-paragraph list items. - - This paragraph won't be part of the note, because it - isn't indented.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[notes]{markdown} +\begin{document} +\begin{markdown} + + Here is a note reference,[^1] and another.[^longnote] + + [^1]: Here is the note. + + [^longnote]: Here's one with multiple blocks. + + Subsequent paragraphs are indented to show that they + belong to the previous note. + + { some.code } + + The whole paragraph can be indented, or just the + first line. In this way, multi-paragraph notes + work like multi-paragraph list items. + + This paragraph won't be part of the note, because it + isn't indented.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4799,33 +4794,33 @@ indented.Using a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\setupmarkdown[notes = yes] -\starttext -\startmarkdown - - Here is a note reference,[^1] and another.[^longnote] - - [^1]: Here is the note. - - [^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they - belong to the previous note. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph notes - work like multi-paragraph list items. - - This paragraph won't be part of the note, because it - isn't indented.\stopmarkdown -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\setupmarkdown[notes = yes] +\starttext +\startmarkdown + + Here is a note reference,[^1] and another.[^longnote] + + [^1]: Here is the note. + + [^longnote]: Here's one with multiple blocks. + + Subsequent paragraphs are indented to show that they + belong to the previous note. + + { some.code } + + The whole paragraph can be indented, or just the + first line. In this way, multi-paragraph notes + work like multi-paragraph list items. + + This paragraph won't be part of the note, because it + isn't indented.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4846,12 +4841,12 @@ class="header-section-number">2.2.1.37 Optiontrue @@ -4869,21 +4864,21 @@ extension. class="latex">LaTeX Example Enable the PHP Markdown pipe table syntax extension:
-+- | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 |
+ | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 |
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[pipeTables]{markdown} -\begin{document} -\begin{markdown} - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 |\end{markdown} -\end{document}
\documentclass{article} +\usepackage[pipeTables]{markdown} +\begin{document} +\begin{markdown} + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 |\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4922,21 +4917,21 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[pipeTables = yes] -\starttext -\startmarkdown - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 |\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[pipeTables = yes] +\starttext +\startmarkdown + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 |\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5005,20 +5000,20 @@ class="header-section-number">2.2.1.39 OptionEnable the Pandoc raw attribute syntax extension:
-+`$H_2 O$`{=tex} is a liquid.
`$H_2 O$`{=tex} is a liquid.
To enable raw blocks, the
-fencedCode
option must also be enabled:+Here is a mathematical formula: -``` {=tex} -\[distance[i] = - \begin{dcases} - a & b \\ - c & d - \end{dcases} -\] -```
Here is a mathematical formula: +``` {=tex} +\[distance[i] = + \begin{dcases} + a & b \\ + c & d + \end{dcases} +\] +```
The
class="latex">LaTeX ExamplerawAttribute
option is a good alternative to thehybrid
option. Unlike thehybrid
option, which affects the @@ -5040,22 +5035,22 @@ allows you to isolate the parts of your documents that use TeX:Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[rawAttribute, fencedCode]{markdown} -\usepackage{expl3} -\begin{document} -\begin{markdown} -$H_2 O$`{=tex} is a liquid. - ` - - ``` {=html} - <p>Here is some HTML content that will be ignored.</p> - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage[rawAttribute, fencedCode]{markdown} +\usepackage{expl3} +\begin{document} +\begin{markdown} +$H_2 O$`{=tex} is a liquid. + ` + + ``` {=html} + <p>Here is some HTML content that will be ignored.</p> + ```\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5074,14 +5069,14 @@ class="header-section-number">2.2.1.40 OptionEnable relative references in autolinks:
-+- I conclude in Section <#conclusion>. - - Conclusion {#conclusion}========== - - In this paper, we have discovered that most - grandmas would rather eat dinner with their grandchildren than get eaten. Begone, wolf!
@@ -5098,26 +5093,26 @@ class="sourceCode md">+ I conclude in Section <#conclusion>. + + Conclusion {#conclusion}========== + + In this paper, we have discovered that most + grandmas would rather eat dinner with their grandchildren than get eaten. Begone, wolf!
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes, relativeReferences]{markdown} -\begin{document} -\begin{markdown} - - - I conclude in Section <#conclusion>. - - Conclusion {#conclusion} - ========== - In this paper, we have discovered that most - grandmas would rather eat dinner with their - grandchildren than get eaten. Begone, wolf! -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[headerAttributes, relativeReferences]{markdown} +\begin{document} +\begin{markdown} + + + I conclude in Section <#conclusion>. + + Conclusion {#conclusion} + ========== + In this paper, we have discovered that most + grandmas would rather eat dinner with their + grandchildren than get eaten. Begone, wolf! +\end{markdown} +\end{document}
Next, invoke LuaTeX twice from the terminal:
-+lualatex document.tex -lualatex document.tex
lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5143,32 +5138,32 @@ when ⟨shift amount⟩ is positive, and to level 1, when class="tex">TeX ExampleUsing a text editor, create a text document named
-example.md
with the following content:+## A section
## A section
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\font\normal=cmr10\normal -\font\big=cmr10 at 12pt -\def\markdownRendererHeadingTwo#1{{\big #1\par}} -\font\bigger=cmr10 scaled 1440 -\def\markdownRendererHeadingOne#1{{\bigger #1\par}} - -\def\markdownOptionShiftHeadings{-1} -\markdownInput{example.md} - -\def\markdownOptionShiftHeadings{0} -\markdownInput{example.md} - -\def\markdownOptionShiftHeadings{+1} -\markdownInput{example.md} - -\bye
\input markdown + +\font\normal=cmr10\normal +\font\big=cmr10 at 12pt +\def\markdownRendererHeadingTwo#1{{\big #1\par}} +\font\bigger=cmr10 scaled 1440 +\def\markdownRendererHeadingOne#1{{\bigger #1\par}} + +\def\markdownOptionShiftHeadings{-1} +\markdownInput{example.md} + +\def\markdownOptionShiftHeadings{0} +\markdownInput{example.md} + +\def\markdownOptionShiftHeadings{+1} +\markdownInput{example.md} + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5180,20 +5175,20 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{filecontents}[overwrite,nosearch,noheader]{example.md} - - ## A section\end{filecontents} -\begin{document} -\markdownInput[shiftHeadings=-1]{example.md} -\markdownInput{example.md} -\markdownInput[shiftHeadings=+1]{example.md} -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{filecontents}[overwrite,nosearch,noheader]{example.md} + + ## A section\end{filecontents} +\begin{document} +\markdownInput[shiftHeadings=-1]{example.md} +\markdownInput{example.md} +\markdownInput[shiftHeadings=+1]{example.md} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5205,22 +5200,22 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-example.md
with the following content:+## A section
## A section
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\starttext - -\inputmarkdown[shiftHeadings = -1]{example.md} -\inputmarkdown[shiftHeadings = 0]{example.md} -\inputmarkdown[shiftHeadings = +1]{example.md} - -\stoptext
\usemodule[t][markdown] +\starttext + +\inputmarkdown[shiftHeadings = -1]{example.md} +\inputmarkdown[shiftHeadings = 0]{example.md} +\inputmarkdown[shiftHeadings = +1]{example.md} + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5264,43 +5259,43 @@ i.e. the entire section with the HTML attribute class="tex">TeX ExampleUsing a text editor, create a text document named
-hamlet.md
with the following content:+# The Tragedy of Hamlet - - Shakespeare's longest play. -## Act III {#act-3} - - Hamlet kills Polonius. -## Act V {#act-5} - - Hamlet dies. -## Act I {#act-1} - Hamlet talks to ghost.
# The Tragedy of Hamlet + + Shakespeare's longest play. +## Act III {#act-3} + + Hamlet kills Polonius. +## Act V {#act-5} + + Hamlet dies. +## Act I {#act-1} + Hamlet talks to ghost.
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionHeaderAttributes{true} - -\font\normal=cmr10\normal -\font\big=cmr10 at 12pt -\def\markdownRendererHeadingTwo#1{{\big #1\par}} -\font\bigger=cmr10 scaled 1440 -\def\markdownRendererHeadingOne#1{{\bigger #1\par}} - -\def\markdownOptionSlice{^ ^act-3} -\markdownInput{hamlet.md} - -\def\markdownOptionSlice{act-1} -\markdownInput{hamlet.md} - -\def\markdownOptionSlice{act-3 act-5} -\markdownInput{hamlet.md} - -\bye
\input markdown +\def\markdownOptionHeaderAttributes{true} + +\font\normal=cmr10\normal +\font\big=cmr10 at 12pt +\def\markdownRendererHeadingTwo#1{{\big #1\par}} +\font\bigger=cmr10 scaled 1440 +\def\markdownRendererHeadingOne#1{{\bigger #1\par}} + +\def\markdownOptionSlice{^ ^act-3} +\markdownInput{hamlet.md} + +\def\markdownOptionSlice{act-1} +\markdownInput{hamlet.md} + +\def\markdownOptionSlice{act-3 act-5} +\markdownInput{hamlet.md} + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5317,30 +5312,30 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes]{markdown} -\begin{filecontents}[overwrite,nosearch,noheader]{hamlet.md} - - # The Tragedy of Hamlet - Shakespeare's longest play. - - ## Act III {#act-3} - Hamlet kills Polonius. - - ## Act V {#act-5} - Hamlet dies. - - ## Act I {#act-1} - Hamlet talks to ghost.\end{filecontents} -\begin{document} -\markdownInput[slice=^ ^act-3]{hamlet.md} -\markdownInput[slice=act-1]{hamlet.md} -\markdownInput[slice=act-3 act-5]{hamlet.md} -\end{document}
\documentclass{article} +\usepackage[headerAttributes]{markdown} +\begin{filecontents}[overwrite,nosearch,noheader]{hamlet.md} + + # The Tragedy of Hamlet + Shakespeare's longest play. + + ## Act III {#act-3} + Hamlet kills Polonius. + + ## Act V {#act-5} + Hamlet dies. + + ## Act I {#act-1} + Hamlet talks to ghost.\end{filecontents} +\begin{document} +\markdownInput[slice=^ ^act-3]{hamlet.md} +\markdownInput[slice=act-1]{hamlet.md} +\markdownInput[slice=act-3 act-5]{hamlet.md} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5357,33 +5352,33 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-hamlet.md
with the following content:+# The Tragedy of Hamlet - - Shakespeare's longest play. -## Act III {#act-3} - - Hamlet kills Polonius. -## Act V {#act-5} - - Hamlet dies. -## Act I {#act-1} - Hamlet talks to ghost.
# The Tragedy of Hamlet + + Shakespeare's longest play. +## Act III {#act-3} + + Hamlet kills Polonius. +## Act V {#act-5} + + Hamlet dies. +## Act I {#act-1} + Hamlet talks to ghost.
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[headerAttributes = yes] -\starttext - -\inputmarkdown[slice = ^ ^act-3]{example.md} -\inputmarkdown[slice = act-1]{example.md} -\inputmarkdown[slice = act-3 act-5]{example.md} - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[headerAttributes = yes] +\starttext + +\inputmarkdown[slice = ^ ^act-3]{example.md} +\inputmarkdown[slice = act-1]{example.md} +\inputmarkdown[slice = act-3 act-5]{example.md} + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5424,25 +5419,25 @@ class="tex">TeX macro. ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererEllipsis{. . .} -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new() - local input = "These are just three regular dots ..." - tex.sprint(convert(input)) }\par -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new({smartEllipses = true}) - local input = "... and this is a victorian ellipsis." - tex.sprint(convert(input)) }\bye
\input markdown +\def\markdownRendererEllipsis{. . .} +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new() + local input = "These are just three regular dots ..." + tex.sprint(convert(input)) }\par +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new({smartEllipses = true}) + local input = "... and this is a victorian ellipsis." + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5452,23 +5447,23 @@ contain the following text:Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererEllipsis{. . .} -\input lmfonts -\input optionfalse -\par -\input optiontrue -\bye
\input markdown +\def\markdownRendererEllipsis{. . .} +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+Are these just three regular dots, a victorian ellipsis, or ... ?
Are these just three regular dots, a victorian ellipsis, or ... ?
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -5489,23 +5484,23 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererEllipsis{. . .} - -\markdownBegin - - These are just three regular dots ...\markdownEnd - -\def\markdownOptionSmartEllipses{true} -\markdownBegin - - ... and this is a victorian ellipsis.\markdownEnd - -\bye
\input markdown +\def\markdownRendererEllipsis{. . .} + +\markdownBegin + + These are just three regular dots ...\markdownEnd + +\def\markdownOptionSmartEllipses{true} +\markdownBegin + + ... and this is a victorian ellipsis.\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5516,28 +5511,28 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = { - ellipsis = {. . .} - } - }\begin{document} - -\begin{markdown} - - These are just three regular dots ...\end{markdown} - -\begin{markdown*}{smartEllipses} - - ... and this is a victorian ellipsis.\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + ellipsis = {. . .} + } + }\begin{document} + +\begin{markdown} + + These are just three regular dots ...\end{markdown} + +\begin{markdown*}{smartEllipses} + + ... and this is a victorian ellipsis.\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5548,24 +5543,24 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererEllipsis{. . .} -\starttext - -\startmarkdown - - These are just three regular dots ...\stopmarkdown - -\setupmarkdown[smartEllipses = yes] -\startmarkdown - - ... and this is a victorian ellipsis.\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\def\markdownRendererEllipsis{. . .} +\starttext + +\startmarkdown + + These are just three regular dots ...\stopmarkdown + +\setupmarkdown[smartEllipses = yes] +\startmarkdown + + ... and this is a victorian ellipsis.\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5603,32 +5598,32 @@ class="tex">TeX macro. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - The following list respects the numbers specified in the markup: - - 3. third item - 4. fourth item - 5. fifth item\end{markdown} - -\begin{markdown*}{startNumber=false} - - The following list does not respect the numbers specified in the - markup: - - 3. third item - 4. fourth item - 5. fifth item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + The following list respects the numbers specified in the markup: + + 3. third item + 4. fourth item + 5. fifth item\end{markdown} + +\begin{markdown*}{startNumber=false} + + The following list does not respect the numbers specified in the + markup: + + 3. third item + 4. fourth item + 5. fifth item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5650,30 +5645,30 @@ markup: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\starttext - -\startmarkdown - - The following list respects the numbers specified in the markup: - - 3. third item - 4. fourth item - 5. fifth item\stopmarkdown - -\setupmarkdown[startNumber = no] -\startmarkdown - - The following list respects the numbers specified in the markup: - - 3. third item - 4. fourth item - 5. fifth item\stopmarkdown -\stoptext
\usemodule[t][markdown] +\starttext + +\startmarkdown + + The following list respects the numbers specified in the markup: + + 3. third item + 4. fourth item + 5. fifth item\stopmarkdown + +\setupmarkdown[startNumber = no] +\startmarkdown + + The following list respects the numbers specified in the markup: + + 3. third item + 4. fourth item + 5. fifth item\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5703,8 +5698,8 @@ class="header-section-number">2.2.1.45 OptionEnable the Pandoc strike-through syntax extension:
-+This ~~is deleted text.~~
@@ -5721,18 +5716,18 @@ class="sourceCode md">This ~~is deleted text.~~
TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionStrikeThrough{true} -\input soulutf8.sty -\def\markdownRendererStrikeThrough#1{\st{#1}} -\markdownBegin - - This is ~~a lunar roving vehicle~~ strike-through text.\markdownEnd -\bye
\input markdown +\def\markdownOptionStrikeThrough{true} +\input soulutf8.sty +\def\markdownRendererStrikeThrough#1{\st{#1}} +\markdownBegin + + This is ~~a lunar roving vehicle~~ strike-through text.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5742,23 +5737,23 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[strikeThrough]{markdown} -\usepackage{soulutf8} -\markdownSetup{ - - renderers = {\st{#1}}, - strikeThrough = { - }, - }\begin{document} -\begin{markdown} - - This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[strikeThrough]{markdown} +\usepackage{soulutf8} +\markdownSetup{ + + renderers = {\st{#1}}, + strikeThrough = { + }, + }\begin{document} +\begin{markdown} + + This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5768,18 +5763,18 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[strikeThrough = yes] -\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} -\starttext -\startmarkdown - - This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[strikeThrough = yes] +\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} +\starttext +\startmarkdown + + This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5797,14 +5792,14 @@ class="header-section-number">2.2.1.46 OptionStrip the minimal indentation of non-blank lines from all lines in a markdown document. Requires that the
-preserveTabs
Lua option is disabled:+\documentclass{article} -\usepackage[stripIndent]{markdown} -\begin{document} -\begin{markdown} - - Hello *world*!\end{markdown} - \end{document}
@@ -5822,50 +5817,50 @@ document. class="tex">TeX Example\documentclass{article} +\usepackage[stripIndent]{markdown} +\begin{document} +\begin{markdown} + + Hello *world*!\end{markdown} + \end{document}
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionStripIndent{true} -\markdownBegin - - Hello *world*!\markdownEnd -\bye
\input markdown +\def\markdownOptionStripIndent{true} +\markdownBegin + + Hello *world*!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[stripIndent]{markdown} -\begin{document} -\begin{markdown} - - Hello *world*!\end{markdown} - \end{document}
\documentclass{article} +\usepackage[stripIndent]{markdown} +\begin{document} +\begin{markdown} + + Hello *world*!\end{markdown} + \end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”ConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[stripIndent = yes] -\starttext -\startmarkdown - - Hello *world*!\stopmarkdown - \stoptext
\usemodule[t][markdown] +\setupmarkdown[stripIndent = yes] +\starttext +\startmarkdown + + Hello *world*!\stopmarkdown + \stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”2.2.1.47 Option
Enable the Pandoc subscript syntax extension:
-+H~2~O is a liquid.
@@ -5898,17 +5893,17 @@ class="sourceCode md">H~2~O is a liquid.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[subscripts]{markdown} -\begin{document} -\begin{markdown} - - H~2~O is a liquid.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[subscripts]{markdown} +\begin{document} +\begin{markdown} + + H~2~O is a liquid.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5918,17 +5913,17 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[subscripts = yes] -\starttext -\startmarkdown - - H~2~O is a liquid.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[subscripts = yes] +\starttext +\startmarkdown + + H~2~O is a liquid.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5946,8 +5941,8 @@ class="header-section-number">2.2.1.48 OptionEnable the Pandoc superscript syntax extension:
-+2^10^ is 1024.
@@ -5964,17 +5959,17 @@ class="sourceCode md">2^10^ is 1024.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[superscripts]{markdown} -\begin{document} -\begin{markdown} - - 2^10^ is 1024.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[superscripts]{markdown} +\begin{document} +\begin{markdown} + + 2^10^ is 1024.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5984,17 +5979,17 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[superscripts = yes] -\starttext -\startmarkdown - - 2^10^ is 1024.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[superscripts = yes] +\starttext +\startmarkdown + + 2^10^ is 1024.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6013,14 +6008,14 @@ class="header-section-number">2.2.1.49 Option href="https://pandoc.org/MANUAL.html#extension-table_captions">table caption syntax extension for pipe tables. -+- | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 | - : Demonstration of pipe table syntax.
@@ -6037,23 +6032,23 @@ class="sourceCode md">+ | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 | + : Demonstration of pipe table syntax.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[pipeTables, tableCaptions]{markdown} -\begin{document} -\begin{markdown} - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 | - - : Demonstration of pipe table syntax.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[pipeTables, tableCaptions]{markdown} +\begin{document} +\begin{markdown} + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 | + + : Demonstration of pipe table syntax.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6093,27 +6088,27 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown - - [ - pipeTables = yes, - tableCaptions = yes, - ]\starttext -\startmarkdown - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 | - - : Demonstration of pipe table syntax.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown + + [ + pipeTables = yes, + tableCaptions = yes, + ]\starttext +\startmarkdown + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 | + + : Demonstration of pipe table syntax.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6161,10 +6156,10 @@ class="header-section-number">2.2.1.50 OptionEnable the Pandoc task list syntax extension:
-+- [ ] an unticked task list item -- [/] a half-checked task list item -- [X] a ticked task list item
@@ -6181,26 +6176,26 @@ class="sourceCode md">- [ ] an unticked task list item +- [/] a half-checked task list item +- [X] a ticked task list item
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[taskLists]{markdown} -\markdownSetup{ - - renderers = { - untickedBox = No, - halfTickedBox = Maybe, - tickedBox = Yes, - }, - }\begin{document} -\begin{markdown} - - - [ ] you can't. - - [/] I can? - - [X] I can!\end{markdown} -\end{document}
\documentclass{article} +\usepackage[taskLists]{markdown} +\markdownSetup{ + + renderers = { + untickedBox = No, + halfTickedBox = Maybe, + tickedBox = Yes, + }, + }\begin{document} +\begin{markdown} + + - [ ] you can't. + - [/] I can? + - [X] I can!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6214,22 +6209,22 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[taskLists = yes] -\def\markdownRendererUntickedBox{No} -\def\markdownRendererHalftickedBox{Maybe} -\def\markdownRendererTickedBox{Yes} -\starttext -\startmarkdown - - - [ ] you can't. - - [/] I can? - - [X] I can!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[taskLists = yes] +\def\markdownRendererUntickedBox{No} +\def\markdownRendererHalftickedBox{Maybe} +\def\markdownRendererTickedBox{Yes} +\starttext +\startmarkdown + + - [ ] you can't. + - [/] I can? + - [X] I can!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6249,15 +6244,15 @@ class="header-section-number">2.2.1.51 Optiontrue @@ -6277,53 +6272,53 @@ comments. class="tex">TeX Example Strip TeX-style comments.
-+\documentclass{article} -\usepackage[texComments]{markdown} -\begin{document} -\begin{markdown} -% this is a comment - Hel - lo *world*!\end{markdown} -\end{document}
\documentclass{article} +\usepackage[texComments]{markdown} +\begin{document} +\begin{markdown} +% this is a comment + Hel + lo *world*!\end{markdown} +\end{document}
Always enabled when
hybrid
is enabled.Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionTexComments{true} -\markdownBegin -% this is a comment - Hel - lo *world*!\markdownEnd -\bye
\input markdown +\def\markdownOptionTexComments{true} +\markdownBegin +% this is a comment + Hel + lo *world*!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[texComments]{markdown} -\begin{document} -\begin{markdown} -% this is a comment - Hel - lo *world*!\end{markdown} -\end{document}
\documentclass{article} +\usepackage[texComments]{markdown} +\begin{document} +\begin{markdown} +% this is a comment + Hel + lo *world*!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”ConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texComments = yes] -\starttext -\startmarkdown -% this is a comment - Hel - lo *world*!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[texComments = yes] +\starttext +\startmarkdown +% this is a comment + Hel + lo *world*!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”2.2.1.52 Option
Enable the Pandoc dollar math syntax extension:
-+inline math: $E=mc^2$ - - display math: $$E=mc^2$$
@@ -6358,21 +6353,21 @@ class="sourceCode md">inline math: $E=mc^2$ + + display math: $$E=mc^2$$
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert = markdown.new({texMathDollars = true}) - local input =$E=mc^2$]] .. newline .. newline .. - [[$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$]] - [[ - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert = markdown.new({texMathDollars = true}) + local input =$E=mc^2$]] .. newline .. newline .. + [[$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$]] + [[ + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6384,24 +6379,24 @@ class="math display">f̂(ξ) = ∫−∞ExampleLua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\par -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+- $E=mc^2$ - $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$
+ $E=mc^2$ + $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ texMathDollars=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ texMathDollars=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -6426,20 +6421,20 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\def\markdownOptionTexMathDollars{true} -\markdownBegin -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\markdownEnd - -\bye
\input markdown + +\def\markdownOptionTexMathDollars{true} +\markdownBegin +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6452,21 +6447,21 @@ class="math display">f̂(ξ) = ∫−∞ class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[texMathDollars]{markdown} -\begin{document} - -\begin{markdown} -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[texMathDollars]{markdown} +\begin{document} + +\begin{markdown} +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6479,21 +6474,21 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texMathDollars = yes] -\starttext - -\startmarkdown -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[texMathDollars = yes] +\starttext + +\startmarkdown +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6515,10 +6510,10 @@ class="header-section-number">2.2.1.53 OptionEnable the Pandoc double backslash math syntax extension:
-+inline math: \\(E=mc^2\\) - -\\[E=mc^2\\] display math:
@@ -6535,21 +6530,21 @@ class="sourceCode md">inline math: \\(E=mc^2\\) + +\\[E=mc^2\\] display math:
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert = markdown.new({texMathDoubleBackslash = true}) - local input =\\(E=mc^2\\)]] .. newline .. newline .. - [[\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\]]] - [[ - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert = markdown.new({texMathDoubleBackslash = true}) + local input =\\(E=mc^2\\)]] .. newline .. newline .. + [[\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\]]] + [[ + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6561,24 +6556,24 @@ class="math display">f̂(ξ) = ∫−∞ExampleLua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\par -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+\\(E=mc^2\\) - -\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\]
\\(E=mc^2\\) + +\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\]
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ texMathDoubleBackslash=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ texMathDoubleBackslash=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -6604,20 +6599,20 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\def\markdownOptionTexMathDoubleBackslash{true} -\markdownBegin -\\(E=mc^2\\) - -\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] -\markdownEnd - -\bye
\input markdown + +\def\markdownOptionTexMathDoubleBackslash{true} +\markdownBegin +\\(E=mc^2\\) + +\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] +\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6630,21 +6625,21 @@ class="math display">f̂(ξ) = ∫−∞ class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[texMathDoubleBackslash]{markdown} -\begin{document} - -\begin{markdown} -\\(E=mc^2\\) - -\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] -\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[texMathDoubleBackslash]{markdown} +\begin{document} + +\begin{markdown} +\\(E=mc^2\\) + +\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] +\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6657,21 +6652,21 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texMathDoubleBackslash = yes] -\starttext - -\startmarkdown -\\(E=mc^2\\) - -\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] -\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[texMathDoubleBackslash = yes] +\starttext + +\startmarkdown +\\(E=mc^2\\) + +\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] +\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6693,10 +6688,10 @@ class="header-section-number">2.2.1.54 OptionEnable the Pandoc single backslash math syntax extension:
-+inline math: \(E=mc^2\) - -\[E=mc^2\] display math:
@@ -6713,21 +6708,21 @@ class="sourceCode md">inline math: \(E=mc^2\) + +\[E=mc^2\] display math:
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert = markdown.new({texMathSingleBackslash = true}) - local input =\(E=mc^2\)]] .. newline .. newline .. - [[\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\]]] - [[ - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert = markdown.new({texMathSingleBackslash = true}) + local input =\(E=mc^2\)]] .. newline .. newline .. + [[\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\]]] + [[ + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6739,24 +6734,24 @@ class="math display">f̂(ξ) = ∫−∞ExampleLua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\par -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+\(E=mc^2\) - -\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\]
\(E=mc^2\) + +\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\]
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ texMathSingleBackslash=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ texMathSingleBackslash=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -6781,20 +6776,20 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\def\markdownOptionTexMathSingleBackslash{true} -\markdownBegin -\(E=mc^2\) - -\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] -\markdownEnd - -\bye
\input markdown + +\def\markdownOptionTexMathSingleBackslash{true} +\markdownBegin +\(E=mc^2\) + +\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] +\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6807,21 +6802,21 @@ class="math display">f̂(ξ) = ∫−∞ class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[texMathSingleBackslash]{markdown} -\begin{document} - -\begin{markdown} -\(E=mc^2\) - -\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] -\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[texMathSingleBackslash]{markdown} +\begin{document} + +\begin{markdown} +\(E=mc^2\) + +\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] +\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6834,21 +6829,21 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texMathSingleBackslash = yes] -\starttext - -\startmarkdown -\(E=mc^2\) - -\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] -\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[texMathSingleBackslash = yes] +\starttext + +\startmarkdown +\(E=mc^2\) + +\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] +\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6870,16 +6865,16 @@ class="header-section-number">2.2.1.55 Option paragraphs will be considered tight. Tight lists will produce tight renderers that may produce different output than lists that are not tight: -+- This is -- a tight -- unordered list. - -- This is - - - not a tight -- unordered list.
@@ -6898,39 +6893,39 @@ multiple paragraphs. class="latex">LaTeX Example- This is +- a tight +- unordered list. + +- This is + + + not a tight +- unordered list.
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - The following list is tight: - - - first item - - second item - - third item - - The following list is loose: - - - first item - - second item that spans - - multiple paragraphs - - third item\end{markdown} - -\begin{markdown*}{tightLists=false} - - The following list is now also loose: - - - first item - - second item - - third item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + The following list is tight: + + - first item + - second item + - third item + + The following list is loose: + + - first item + - second item that spans + + multiple paragraphs + - third item\end{markdown} + +\begin{markdown*}{tightLists=false} + + The following list is now also loose: + + - first item + - second item + - third item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6965,11 +6960,11 @@ class="header-section-number">2.2.1.56 Option@@ -6989,23 +6984,23 @@ constantly escape subscripts. class="tex">TeX Example Both underscores and asterisks can be used to denote emphasis and strong emphasis:
-+- *single asterisks* - _single underscores_ - **double asterisks** __double underscores__
+ *single asterisks* + _single underscores_ + **double asterisks** __double underscores__
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionHybrid{true} - -\markdownBegin -$m\_n$. - This is _emphasized text_ and this is a math subscript: \markdownEnd - -\def\markdownOptionUnderscores{false} -\markdownBegin -$m_n$. - This is *emphasized text* and this is a math subscript: \markdownEnd - -\bye
\input markdown +\def\markdownOptionHybrid{true} + +\markdownBegin +$m\_n$. + This is _emphasized text_ and this is a math subscript: \markdownEnd + +\def\markdownOptionUnderscores{false} +\markdownBegin +$m_n$. + This is *emphasized text* and this is a math subscript: \markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7018,23 +7013,23 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[hybrid]{markdown} -\begin{document} - -\begin{markdown} -$m\_n$. - This is _emphasized text_ and this is a math subscript: \end{markdown} - -\begin{markdown*}{underscores=false} -$m_n$. - This is *emphasized text* and this is a math subscript: \end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[hybrid]{markdown} +\begin{document} + +\begin{markdown} +$m\_n$. + This is _emphasized text_ and this is a math subscript: \end{markdown} + +\begin{markdown*}{underscores=false} +$m_n$. + This is *emphasized text* and this is a math subscript: \end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7047,24 +7042,24 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[hybrid = yes] -\starttext - -\startmarkdown -$m\_n$. - This is _emphasized text_ and this is a math subscript: \stopmarkdown - -\setupmarkdown[underscores = yes] -\startmarkdown -$m_n$. - This is *emphasized text* and this is a math subscript: \stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[hybrid = yes] +\starttext + +\startmarkdown +$m\_n$. + This is _emphasized text_ and this is a math subscript: \stopmarkdown + +\setupmarkdown[underscores = yes] +\startmarkdown +$m_n$. + This is *emphasized text* and this is a math subscript: \stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7091,8 +7086,8 @@ plain TeXtaskLists
Lua option totrue
, you would include the following code in your plain TeX document: -+\def\markdownOptionTaskLists{true}
\def\markdownOptionTaskLists{true}
2.2.2.2 Finalizing and Freezing the Cache
@@ -7142,24 +7137,24 @@ options.Using a text editor, create a folder named
-output-directory
and a text document nameddocument.tex
with the following content:+\input lmfonts -\input markdown -\def\markdownOptionHelperScriptFileName{helper-script.lua} -\def\markdownOptionInputTempFileName{temporary-input.md} -\def\markdownOptionOutputTempFileName{temporary-output.tex} -\def\markdownOptionErrorTempFileName{error-output.txt} -\def\markdownOptionOutputDir{output-directory} -\def\markdownOptionCacheDir{output-directory/cache-directory} -\markdownOptionFinalizeCachetrue -\def\markdownOptionFrozenCacheFileName{output-directory/cache-directory/frozen-cache.tex} -\markdownBegin - - Hello *world*!\markdownEnd -\bye
\input lmfonts +\input markdown +\def\markdownOptionHelperScriptFileName{helper-script.lua} +\def\markdownOptionInputTempFileName{temporary-input.md} +\def\markdownOptionOutputTempFileName{temporary-output.tex} +\def\markdownOptionErrorTempFileName{error-output.txt} +\def\markdownOptionOutputDir{output-directory} +\def\markdownOptionCacheDir{output-directory/cache-directory} +\markdownOptionFinalizeCachetrue +\def\markdownOptionFrozenCacheFileName{output-directory/cache-directory/frozen-cache.tex} +\markdownBegin + + Hello *world*!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex --output-directory output-directory document.tex
luatex --output-directory output-directory document.tex
A text document named
@@ -7172,8 +7167,8 @@ document. LuaTeX does not need other temporary files to perform the conversion from markdown to TeX. To produce the remaining temporary files, invoke pdfTeX from the terminal: -temporary-input.md
should be produced in the folder namedoutput-directory
and contain the following text:+pdftex --output-directory output-directory --shell-escape document.tex
pdftex --output-directory output-directory --shell-escape document.tex
Text documents named
helper-script.lua
, andtemporary-output.md
should be produced in the folder namedoutput-directory
. The document named @@ -7202,21 +7197,21 @@ Mittelbach. The recognized values of the macro aretrue
false
.Using a text editor, create a text document named
-document.dtx
with the following content:+% \iffalse -\documentclass{ltxdoc} -\usepackage[stripPercentSigns]{markdown} -\begin{document} -\DocInput{document.dtx} -\end{document} -% \fi -% -% \begin{markdown} -% Hello *world*! -% \end{markdown}
% \iffalse +\documentclass{ltxdoc} +\usepackage[stripPercentSigns]{markdown} +\begin{document} +\DocInput{document.dtx} +\end{document} +% \fi +% +% \begin{markdown} +% Hello *world*! +% \end{markdown}
Next, invoke LuaTeX from the terminal:
-+lualatex document.dtx
lualatex document.dtx
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”LaTeX. For example, to set the
taskLists
Lua option totrue
, we would include the following code in our LaTeX document: -+\markdownSetup{ - - taskLists = true, }
\markdownSetup{ + + taskLists = true, }
We can also set all plain TeX options directly from LaTeX. For example, to set @@ -7247,10 +7242,10 @@ the
-\markdownOptionHelperScriptFileName
plain TeX option tohelper-script.lua
, we would inclde the following code in our LaTeX document:+\markdownSetup{ - - helperScriptFileName = helper-script.lua, }
\markdownSetup{ + + helperScriptFileName = helper-script.lua, }
2.2.3.2 No default token renderer prototypes
@@ -7265,8 +7260,8 @@ class="tex">TeX implementation and prevent the soft from being loaded: The plain option must be set before or when loading the package. Setting the option after loading the package will have no effect. -+\usepackage[plain]{markdown}
\usepackage[plain]{markdown}
2.2.3.3 LaTeX themes
@@ -7279,11 +7274,11 @@ without low-level programming.For example, to load themes named
-witiko/beamer/MU
andwitiko/dot
, you would use the following code in the preamble of your document:+\usepackage[ - - import=witiko/beamer/MU, - import=witiko/dot,markdown} ]{
\usepackage[ + + import=witiko/beamer/MU, + import=witiko/dot,markdown} ]{
Due to limitations of LaTeX, themes may not be loaded after the beginning of a TeX option is enabled.
class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[import=witiko/dot]{markdown} -\setkeys{Gin}{ -\columnwidth, - width=\paperheight, - height=0.65 - keepaspectratio}\begin{document} -\begin{markdown} - - ``` dot Various formats of mathemathical formulae - digraph tree { - margin = 0; - rankdir = "LR"; - - latex -> pmml; - latex -> cmml; - pmml -> slt; - cmml -> opt; - cmml -> prefix; - cmml -> infix; - pmml -> mterms [style=dashed]; - cmml -> mterms; - - latex [label = "LaTeX"]; - pmml [label = "Presentation MathML"]; - cmml [label = "Content MathML"]; - slt [label = "Symbol Layout Tree"]; - opt [label = "Operator Tree"]; - prefix [label = "Prefix"]; - infix [label = "Infix"]; - mterms [label = "M-Terms"]; - } - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage[import=witiko/dot]{markdown} +\setkeys{Gin}{ +\columnwidth, + width=\paperheight, + height=0.65 + keepaspectratio}\begin{document} +\begin{markdown} + + ``` dot Various formats of mathemathical formulae + digraph tree { + margin = 0; + rankdir = "LR"; + + latex -> pmml; + latex -> cmml; + pmml -> slt; + cmml -> opt; + cmml -> prefix; + cmml -> infix; + pmml -> mterms [style=dashed]; + cmml -> mterms; + + latex [label = "LaTeX"]; + pmml [label = "Presentation MathML"]; + cmml [label = "Content MathML"]; + slt [label = "Symbol Layout Tree"]; + opt [label = "Operator Tree"]; + prefix [label = "Prefix"]; + infix [label = "Infix"]; + mterms [label = "M-Terms"]; + } + ```\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
@@ -7372,18 +7367,18 @@ class="tex">TeX option is enabled. class="latex">LaTeX Exampledocument.pdf
should be produced and contain a drawing of a directed graph similar to Figure 1 from the following conference article:Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[import=witiko/graphicx/http]{markdown} -\begin{document} -\begin{markdown} - - \end{markdown} -\end{document}
\documentclass{article} +\usepackage[import=witiko/graphicx/http]{markdown} +\begin{document} +\begin{markdown} + + \end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following image:@@ -7406,17 +7401,17 @@ Lua option is disabled. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[import=witiko/tilde]{markdown} -\begin{document} -\begin{markdown} - - Bartel~Leendert van~der~Waerden\end{markdown} -\end{document}
\documentclass{article} +\usepackage[import=witiko/tilde]{markdown} +\begin{document} +\begin{markdown} + + Bartel~Leendert van~der~Waerden\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
@@ -7433,82 +7428,99 @@ class="latex">LaTeX snippets provide syntactic sugar for defining and invoking various options locally.document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:Here is how we can use snippets to store options and invoke them later:
-+\markdownSetupSnippet{romanNumerals}{ - - renderers = {% - olItemWithNumber = {\item[\romannumeral#1\relax.]% - - }, - }, - }\begin{markdown} - - - The following ordered list will be preceded by arabic numerals: - - 1. wahid - 2. aithnayn -\end{markdown} -\begin{markdown*}{snippet=romanNumerals} - - - The following ordered list will be preceded by roman numerals: - - 3. tres - 4. quattuor -\end{markdown*}
\markdownSetupSnippet{romanNumerals}{ + + renderers = {% + olItemWithNumber = {\item[\romannumeral#1\relax.]% + + }, + }, + }\begin{markdown} + + + The following ordered list will be preceded by arabic numerals: + + 1. wahid + 2. aithnayn +\end{markdown} +\begin{markdown*}{snippet=romanNumerals} + + + The following ordered list will be preceded by roman numerals: + + 3. tres + 4. quattuor +\end{markdown*}
If the
-romanNumerals
snippet were defined in the -jdoe/lists
theme, we can import the theme and use the -qualified name of the snippet:+\markdownSetup{import=jdoe/lists} -\begin{markdown*}{snippet=jdoe/lists/romanNumerals} - - - The following ordered list will be preceded by roman numerals: - - 3. tres - 4. quattuor -\end{markdown*}
jdoe/lists
theme, we could import the +jdoe/lists
theme and use the qualified name +jdoe/lists/romanNumerals
to invoke the snippet: +\markdownSetup{import=jdoe/lists} +\begin{markdown*}{snippet=jdoe/lists/romanNumerals} + + + The following ordered list will be preceded by roman numerals: + + 3. tres + 4. quattuor +\end{markdown*}
Alternatively, we can use the extended variant of the
-import
LaTeX option that allows us to import theromanNumerals
snippet to the current -namespace, so that we can invoke the snippet with less typing:+namespace for easier access: +\markdownSetup{ - - import = { - jdoe/lists = romanNumerals, - }, - }\begin{markdown*}{snippet=romanNumerals} - - - The following ordered list will be preceded by roman numerals: - - 3. tres - 4. quattuor -\end{markdown*}
\markdownSetup{ + + import = { + jdoe/lists = romanNumerals, + }, + }\begin{markdown*}{snippet=romanNumerals} + + + The following ordered list will be preceded by roman numerals: + + 3. tres + 4. quattuor +\end{markdown*}
Furthermore, we can also specify the name of the snippet in the -current namespace, which is different from the name of the snippet in -the
-jdoe/lists
theme:+current namespace, which can be different from the name of the snippet +in the\markdownSetup{ - - import = { - jdoe/lists = romanNumerals as roman, - }, - }\begin{markdown*}{snippet=roman} - - - The following ordered list will be preceded by roman numerals: - - 3. tres - 4. quattuor -\end{markdown*}
jdoe/lists
theme. For example, we can make the +snippetjdoe/lists/romanNumerals
available under the name +roman
. +\markdownSetup{ + + import = { + jdoe/lists = romanNumerals as roman, + }, + }\begin{markdown*}{snippet=roman} + + + The following ordered list will be preceded by roman numerals: + + 3. tres + 4. quattuor +\end{markdown*}
Several themes and/or snippets can be loaded at once using the extended variant of the
+class="latex">LaTeX option: +import
LaTeX option.\markdownSetup{ + + import = { + jdoe/longpackagename/lists = { + arabic as arabic1, + roman, + alphabetic, + }, + jdoe/anotherlongpackagename/lists = { + arabic as arabic2, + }, + jdoe/yetanotherlongpackagename, + }, }
2.3 Markdown Tokens
A key feature of the Markdown package is the support for manipulating @@ -7549,42 +7561,42 @@ attributes that correspond to the ⟨key⟩ and the class="latex">LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes, underscores=false]{markdown} -\markdownSetup{ - - renderers = {% - attributeIdentifier = {\par - \emph{(Identifier: #1)} - \par - - },% - attributeClassName = {\par - \emph{(Class name: #1)} - \par - - },% - attributeKeyValue = {\par - \emph{(Key: #1, Value: #2)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - - # First top-level heading {jane=doe} - - ## A subheading {#identifier} - - # Second top-level heading {.class_name} -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[headerAttributes, underscores=false]{markdown} +\markdownSetup{ + + renderers = {% + attributeIdentifier = {\par + \emph{(Identifier: #1)} + \par + + },% + attributeClassName = {\par + \emph{(Class name: #1)} + \par + + },% + attributeKeyValue = {\par + \emph{(Key: #1, Value: #2)} + \par + + }, + }, + }\begin{document} +\begin{markdown} + + + # First top-level heading {jane=doe} + + ## A subheading {#identifier} + + # Second top-level heading {.class_name} +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7605,31 +7617,31 @@ end of a block quote. The macro receives no arguments. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererBlockQuoteBegin{% -\begingroup - \vskip\parindent - \leftskip=2\parindent - \parindent=0pt - - }\def\markdownRendererBlockQuoteEnd{% -\par - \vskip\parindent - \endgroup - - }\markdownBegin - - A quote from William Shakespeare's King Lear: - - > This is the excellent foppery of the world that when we are - > sick in fortune---often the surfeit of our own behavior---we - > make guilty of our disasters the sun, the moon, and the - > stars [...]\markdownEnd -\bye
\input markdown +\def\markdownRendererBlockQuoteBegin{% +\begingroup + \vskip\parindent + \leftskip=2\parindent + \parindent=0pt + + }\def\markdownRendererBlockQuoteEnd{% +\par + \vskip\parindent + \endgroup + + }\markdownBegin + + A quote from William Shakespeare's King Lear: + + > This is the excellent foppery of the world that when we are + > sick in fortune---often the surfeit of our own behavior---we + > make guilty of our disasters the sun, the moon, and the + > stars [...]\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7644,28 +7656,28 @@ disasters the sun, the moon, and the stars […] class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {\begin{quote}}, - blockQuoteBegin = {\end{quote}}, - blockQuoteEnd = { - }, - }\begin{document} -\begin{markdown} - - A quote from William Shakespeare's King Lear: - - > This is the excellent foppery of the world that when we are - > sick in fortune---often the surfeit of our own behavior---we - > make guilty of our disasters the sun, the moon, and the - > stars [...]\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {\begin{quote}}, + blockQuoteBegin = {\end{quote}}, + blockQuoteEnd = { + }, + }\begin{document} +\begin{markdown} + + A quote from William Shakespeare's King Lear: + + > This is the excellent foppery of the world that when we are + > sick in fortune---often the surfeit of our own behavior---we + > make guilty of our disasters the sun, the moon, and the + > stars [...]\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7680,23 +7692,23 @@ disasters the sun, the moon, and the stars […] class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererBlockQuoteBegin{\startquotation} -\def\markdownRendererBlockQuoteEnd{\stopquotation} -\starttext -\startmarkdown - - A quote from William Shakespeare's King Lear: - - > This is the excellent foppery of the world that when we are - > sick in fortune---often the surfeit of our own behavior---we - > make guilty of our disasters the sun, the moon, and the - > stars [...]\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererBlockQuoteBegin{\startquotation} +\def\markdownRendererBlockQuoteEnd{\stopquotation} +\starttext +\startmarkdown + + A quote from William Shakespeare's King Lear: + + > This is the excellent foppery of the world that when we are + > sick in fortune---often the surfeit of our own behavior---we + > make guilty of our disasters the sun, the moon, and the + > stars [...]\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7722,25 +7734,25 @@ arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[bracketedSpans]{markdown} -\markdownSetup{ - - renderers = { - bracketedSpanAttributeContextBegin = {(}, - bracketedSpanAttributeContextEnd = {)}, - }, - }\begin{document} -\begin{markdown} - - - [foo [bar]{#identifier}]{key=value} [baz]{.class_name} -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[bracketedSpans]{markdown} +\markdownSetup{ + + renderers = { + bracketedSpanAttributeContextBegin = {(}, + bracketedSpanAttributeContextEnd = {)}, + }, + }\begin{document} +\begin{markdown} + + + [foo [bar]{#identifier}]{key=value} [baz]{.class_name} +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7773,52 +7785,52 @@ receives no arguments. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionTightLists{true} - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererUlBeginTight{ (} -\def\markdownRendererUlItem{% -\def\markdownRendererUlItem{% - - ,\def\markdownRendererUlItem{, and }% - % - } - }\def\markdownRendererUlItemEnd{} -\def\markdownRendererUlEndTight{).} - -\markdownBegin - - This is a tight list - - - the first item - - the second item - - the third item\markdownEnd - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererUlBegin{} -\def\markdownRendererUlItem{--\kern 0.5em} -\def\markdownRendererUlItemEnd{.\par} -\def\markdownRendererUlEnd{} - -\markdownBegin - - This is a loose list - - - This is the first item - - - This is the second item - - - This is the third item\markdownEnd - -\bye
\input markdown +\def\markdownOptionTightLists{true} + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererUlBeginTight{ (} +\def\markdownRendererUlItem{% +\def\markdownRendererUlItem{% + + ,\def\markdownRendererUlItem{, and }% + % + } + }\def\markdownRendererUlItemEnd{} +\def\markdownRendererUlEndTight{).} + +\markdownBegin + + This is a tight list + + - the first item + - the second item + - the third item\markdownEnd + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererUlBegin{} +\def\markdownRendererUlItem{--\kern 0.5em} +\def\markdownRendererUlItemEnd{.\par} +\def\markdownRendererUlEnd{} + +\markdownBegin + + This is a loose list + + - This is the first item + + - This is the second item + + - This is the third item\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7835,57 +7847,57 @@ item). class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[tightLists]{markdown} -\begin{document} - -\begin{markdown*}{ - - renderers = { - interblockSeparator = {}, - ulBeginTight = { (},% - ulItem = {\def\markdownRendererUlItem{% - - ,\def\markdownRendererUlItem{, and }% - % - } - }, - ulItemEnd = {}, - ulEndTight = {).}, - }, - } - This is a tight list - - - the first item - - the second item - - the third item\end{markdown*} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {\par - :\def\markdownRendererInterblockSeparator{\par}% - - },\begin{itemize}}, - ulBeginTight = {\item}, - ulItem = { - ulItemEnd = {.},\end{itemize}}, - ulEnd = { - }, - } - This is a loose list - - - This is the first item - - - This is the second item - - - This is the third item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[tightLists]{markdown} +\begin{document} + +\begin{markdown*}{ + + renderers = { + interblockSeparator = {}, + ulBeginTight = { (},% + ulItem = {\def\markdownRendererUlItem{% + + ,\def\markdownRendererUlItem{, and }% + % + } + }, + ulItemEnd = {}, + ulEndTight = {).}, + }, + } + This is a tight list + + - the first item + - the second item + - the third item\end{markdown*} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {\par + :\def\markdownRendererInterblockSeparator{\par}% + + },\begin{itemize}}, + ulBeginTight = {\item}, + ulItem = { + ulItemEnd = {.},\end{itemize}}, + ulEnd = { + }, + } + This is a loose list + + - This is the first item + + - This is the second item + + - This is the third item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7902,53 +7914,53 @@ item). class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[tightLists = yes] -\starttext - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererUlBeginTight{ (} -\def\markdownRendererUlItem{% -\def\markdownRendererUlItem{% - - ,\def\markdownRendererUlItem{, and }% - % - } - }\def\markdownRendererUlItemEnd{} -\def\markdownRendererUlEndTight{).} - -\startmarkdown - - This is a tight list - - - the first item - - the second item - - the third item\stopmarkdown - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererUlBegin{\startitemize} -\def\markdownRendererUlItem{\item} -\def\markdownRendererUlItemEnd{.} -\def\markdownRendererUlEnd{\stopitemize} - -\startmarkdown - - This is a loose list - - - This is the first item - - - This is the second item - - - This is the third item\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[tightLists = yes] +\starttext + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererUlBeginTight{ (} +\def\markdownRendererUlItem{% +\def\markdownRendererUlItem{% + + ,\def\markdownRendererUlItem{, and }% + % + } + }\def\markdownRendererUlItemEnd{} +\def\markdownRendererUlEndTight{).} + +\startmarkdown + + This is a tight list + + - the first item + - the second item + - the third item\stopmarkdown + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererUlBegin{\startitemize} +\def\markdownRendererUlItem{\item} +\def\markdownRendererUlItemEnd{.} +\def\markdownRendererUlEnd{\stopitemize} + +\startmarkdown + + This is a loose list + + - This is the first item + + - This is the second item + + - This is the third item\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7975,79 +7987,79 @@ contaning the code block contents and to the code fence infostring. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{verbatim} -\usepackage[hyphens]{url} -\usepackage[fencedCode]{markdown} -\markdownSetup{ - - renderers = { - interblockSeparator = {\def\markdownRendererInterblockSeparator{% - \par - \def\markdownRendererInterblockSeparator{% - \def\markdownRendererInterblockSeparator{% - \par - % - }% - }% - } - }, - inputVerbatim = {\url{#1}:% - is contained in file \verbatiminput{#1}% - - }, - inputFencedCode = {\markdownRendererInputVerbatim{#1}% - in #2 - }, - }, - }\begin{document} -\begin{markdown} - - The following code - - def foo(bar): - if len(bar) <= 1: - return bar[0] - elif len(bar) == 2: - return sorted(bar) - else: - baz = len(bar) // 2 - return foo(bar[baz:], bar[:baz]) - - The following code - - ~~~ Python - >>> foo([4, 2, 1, 3]) - [1, 2, 3, 4] - ~~~~~~~~~~\end{markdown} -\end{document}
\documentclass{article} +\usepackage{verbatim} +\usepackage[hyphens]{url} +\usepackage[fencedCode]{markdown} +\markdownSetup{ + + renderers = { + interblockSeparator = {\def\markdownRendererInterblockSeparator{% + \par + \def\markdownRendererInterblockSeparator{% + \def\markdownRendererInterblockSeparator{% + \par + % + }% + }% + } + }, + inputVerbatim = {\url{#1}:% + is contained in file \verbatiminput{#1}% + + }, + inputFencedCode = {\markdownRendererInputVerbatim{#1}% + in #2 + }, + }, + }\begin{document} +\begin{markdown} + + The following code + + def foo(bar): + if len(bar) <= 1: + return bar[0] + elif len(bar) == 2: + return sorted(bar) + else: + baz = len(bar) // 2 + return foo(bar[baz:], bar[:baz]) + + The following code + + ~~~ Python + >>> foo([4, 2, 1, 3]) + [1, 2, 3, 4] + ~~~~~~~~~~\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text except for the filename, which may differ:The following code is contained in file
-./_markdown_document/882453149edcf288976647f6fe147ada.verbatim
:+def foo(bar): -if len(bar) <= 1: - return bar[:1] - elif len(bar) == 2: - return sorted(bar) - else: - = bar[len(bar) // 2] - baz return ( - for qux in bar if qux < baz]) + [baz] + - foo([qux for qux in bar if qux > baz]) - foo([qux )
def foo(bar): +if len(bar) <= 1: + return bar[:1] + elif len(bar) == 2: + return sorted(bar) + else: + = bar[len(bar) // 2] + baz return ( + for qux in bar if qux < baz]) + [baz] + + foo([qux for qux in bar if qux > baz]) + foo([qux )
The following code in Python contained in file
-./_markdown_document/cf2a96e2120cef5b1fae5fea36fcc27b.verbatim
:+>>> foo([4, 2, 1, 3]) -1, 2, 3, 4] [
>>> foo([4, 2, 1, 3]) +1, 2, 3, 4] [
2.3.1.6 Code Span Renderer
@@ -8058,27 +8070,27 @@ corresponds to the inline code span. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts - -\def\markdownRendererCodeSpan#1{#1} - -\markdownBegin -$\sqrt{-1}$ *equals* $i$` - ` -$\sqrt{-1}$ *equals* $i$ -\markdownEnd - -\def\markdownOptionHybrid{true} -\markdownBegin -$\sqrt{-1}$ *equals* $i$ -\markdownEnd - -\bye
\input markdown +\input lmfonts + +\def\markdownRendererCodeSpan#1{#1} + +\markdownBegin +$\sqrt{-1}$ *equals* $i$` + ` +$\sqrt{-1}$ *equals* $i$ +\markdownEnd + +\def\markdownOptionHybrid{true} +\markdownBegin +$\sqrt{-1}$ *equals* $i$ +\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8091,30 +8103,30 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[smartEllipses]{markdown} -\markdownSetup{ - - renderers = { - codeSpan = {#1}, - }, - }\begin{document} - -\begin{markdown} -$\sqrt{-1}$ *equals* $i$` - ` -$\sqrt{-1}$ *equals* $i$ -\end{markdown} - -\begin{markdown*}{hybrid} -$\sqrt{-1}$ *equals* $i$ -\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[smartEllipses]{markdown} +\markdownSetup{ + + renderers = { + codeSpan = {#1}, + }, + }\begin{document} + +\begin{markdown} +$\sqrt{-1}$ *equals* $i$` + ` +$\sqrt{-1}$ *equals* $i$ +\end{markdown} + +\begin{markdown*}{hybrid} +$\sqrt{-1}$ *equals* $i$ +\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8127,26 +8139,26 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererCodeSpan#1{#1} -\starttext - -\startmarkdown -$\sqrt{-1}$ *equals* $i$` - ` -$\sqrt{-1}$ *equals* $i$ -\stopmarkdown - -\setupmarkdown[hybrid = yes] -\startmarkdown -$\sqrt{-1}$ *equals* $i$ -\stopmarkdown - -\bye
\usemodule[t][markdown] +\def\markdownRendererCodeSpan#1{#1} +\starttext + +\startmarkdown +$\sqrt{-1}$ *equals* $i$` + ` +$\sqrt{-1}$ *equals* $i$ +\stopmarkdown + +\setupmarkdown[hybrid = yes] +\startmarkdown +$\sqrt{-1}$ *equals* $i$ +\stopmarkdown + +\bye
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8171,26 +8183,26 @@ arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[inlineCodeAttributes]{markdown} -\markdownSetup{ - - renderers = { - codeSpanAttributeContextBegin = {(}, - codeSpan = {#1}, - codeSpanAttributeContextEnd = {)}, - }, - }\begin{document} -\begin{markdown} - - - foo `bar`{key=value} baz -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[inlineCodeAttributes]{markdown} +\markdownSetup{ + + renderers = { + codeSpanAttributeContextBegin = {(}, + codeSpan = {#1}, + codeSpanAttributeContextEnd = {)}, + }, + }\begin{document} +\begin{markdown} + + + foo `bar`{key=value} baz +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8241,34 +8253,34 @@ starting point. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionContentBlocks{true} -\def\markdownRendererContentBlock#1#2#3#4{% -\tt #2}, #4. - This is { - }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{% -\tt #2}, #4. - This is the image { - }\def\markdownRendererContentBlockCode#1#2#3#4#5{% -\uppercase{#1}) document {\tt #3}, #5. - This is the #2 ( - }\markdownBegin - - /document.tex (the document that we are currently typesetting) - /markdown-languages.json (the mapping between filename extensions - and programming language names) - https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\markdownEnd -\bye
\input markdown +\def\markdownOptionContentBlocks{true} +\def\markdownRendererContentBlock#1#2#3#4{% +\tt #2}, #4. + This is { + }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{% +\tt #2}, #4. + This is the image { + }\def\markdownRendererContentBlockCode#1#2#3#4#5{% +\uppercase{#1}) document {\tt #3}, #5. + This is the #2 ( + }\markdownBegin + + /document.tex (the document that we are currently typesetting) + /markdown-languages.json (the mapping between filename extensions + and programming language names) + https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\markdownEnd +\bye
Create also a text document named
-markdown-languages.json
with the following content:+- {"json": "JavaScript Object Notation", - }
+ {"json": "JavaScript Object Notation", + }
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8284,34 +8296,34 @@ the logotype of TUGboat. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\begin{filecontents}[overwrite,nosearch,noheader]{markdown-languages.json} - - { - "json": "JavaScript Object Notation", - }\end{filecontents} -\usepackage[contentBlocks]{markdown} -\markdownSetup{ - - renderers = {\texttt{#2}, #4.}, - contentBlock = {This is \texttt{#2}, #4.}, - contentBlockOnlineImage = {This is the image % - contentBlockCode = {\MakeUppercase{#1}) document \texttt{#3}, #5. - This is the #2 ( - }, - }, - }\begin{document} -\begin{markdown} - - /document.tex (the document that we are currently typesetting) - /markdown-languages.json (the mapping between filename extensions - and programming language names) - https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\end{markdown} -\end{document}
\documentclass{article} +\begin{filecontents}[overwrite,nosearch,noheader]{markdown-languages.json} + + { + "json": "JavaScript Object Notation", + }\end{filecontents} +\usepackage[contentBlocks]{markdown} +\markdownSetup{ + + renderers = {\texttt{#2}, #4.}, + contentBlock = {This is \texttt{#2}, #4.}, + contentBlockOnlineImage = {This is the image % + contentBlockCode = {\MakeUppercase{#1}) document \texttt{#3}, #5. + This is the #2 ( + }, + }, + }\begin{document} +\begin{markdown} + + /document.tex (the document that we are currently typesetting) + /markdown-languages.json (the mapping between filename extensions + and programming language names) + https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8327,35 +8339,35 @@ the logotype of TUGboat. class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[contentBlocks = yes] -\def\markdownRendererContentBlock#1#2#3#4{% -\tt #2}, #4. - This is { - }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{% -\tt #2}, #4. - This is the image { - }\def\markdownRendererContentBlockCode#1#2#3#4#5{% -\uppercase{#1}) document {\tt #3}, #5. - This is the #2 ( - }\starttext -\startmarkdown - - /document.tex (the document that we are currently typesetting) - /markdown-languages.json (the mapping between filename extensions - and programming language names) - https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[contentBlocks = yes] +\def\markdownRendererContentBlock#1#2#3#4{% +\tt #2}, #4. + This is { + }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{% +\tt #2}, #4. + This is the image { + }\def\markdownRendererContentBlockCode#1#2#3#4#5{% +\uppercase{#1}) document {\tt #3}, #5. + This is the #2 ( + }\starttext +\startmarkdown + + /document.tex (the document that we are currently typesetting) + /markdown-languages.json (the mapping between filename extensions + and programming language names) + https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\stopmarkdown +\stoptext
Create also a text document named
-markdown-languages.json
with the following content:+- {"json": "JavaScript Object Notation", - }
+ {"json": "JavaScript Object Notation", + }
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8377,8 +8389,8 @@ beginning of a definition list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.The
\markdownRendererDlBeginTight
macro represents the -beginning of a definition list that contains an item with several -paragraphs of text (the list is not tight). This macro will only be +beginning of a definition list that contains no item with several +paragraphs of text (the list is tight). This macro will only be produced, when thetightLists
option is disabled. The macro receives no arguments.The
class="tex">TeX Example\markdownRendererDlItem
macro represents a term in a @@ -8404,88 +8416,88 @@ receives no arguments.Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionDefinitionLists{true} -\def\markdownOptionTightLists{true} - -\def\markdownRendererInterblockSeparator{% -% - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBeginTight{% -\begingroup - \parindent=0pt - - }\def\markdownRendererDlItem#1{% -\par{\bf#1}% - \def\markdownRendererDlDefinitionEnd{% - - ,\def\markdownRendererDlDefinitionEnd{% - - , and\def\markdownRendererDlDefinitionEnd{.}% - % - }% - } - }\def\markdownRendererDlItemEnd{} -\def\markdownRendererDlDefinitionBegin{\par--\kern 0.5em} -\def\markdownRendererDlEndTight{\endgroup} - -\markdownBegin - - This is a tight definition list - - Coffee - : black hot drink - : prepared from roasted coffee beans - : one of the most traded agricultural commodities in the world - - Milk - : white cold drink - : nutrient-rich - : produced on an industrial scale\markdownEnd - -\def\markdownRendererInterblockSeparator{% -\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBegin{} -\def\markdownRendererDlItem#1{% - - . #1 is a\def\markdownRendererDlDefinitionBegin{% - \def\markdownRendererDlDefinitionBegin{% - - ,\def\markdownRendererDlDefinitionBegin{, and }% - % - }% - } - }\def\markdownRendererDlItemEnd{} -\def\markdownRendererDlDefinitionEnd{} -\def\markdownRendererDlEnd{.} - -\markdownBegin - - This is a loose definition list - - Coffee - - : black hot drink - - : prepared from roasted coffee beans - - : one of the most traded agricultural commodities in the world - - Milk - - : white cold drink - - : nutrient-rich - - : produced on an industrial scale\markdownEnd - -\bye
\input markdown +\def\markdownOptionDefinitionLists{true} +\def\markdownOptionTightLists{true} + +\def\markdownRendererInterblockSeparator{% +% + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBeginTight{% +\begingroup + \parindent=0pt + + }\def\markdownRendererDlItem#1{% +\par{\bf#1}% + \def\markdownRendererDlDefinitionEnd{% + + ,\def\markdownRendererDlDefinitionEnd{% + + , and\def\markdownRendererDlDefinitionEnd{.}% + % + }% + } + }\def\markdownRendererDlItemEnd{} +\def\markdownRendererDlDefinitionBegin{\par--\kern 0.5em} +\def\markdownRendererDlEndTight{\endgroup} + +\markdownBegin + + This is a tight definition list + + Coffee + : black hot drink + : prepared from roasted coffee beans + : one of the most traded agricultural commodities in the world + + Milk + : white cold drink + : nutrient-rich + : produced on an industrial scale\markdownEnd + +\def\markdownRendererInterblockSeparator{% +\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBegin{} +\def\markdownRendererDlItem#1{% + + . #1 is a\def\markdownRendererDlDefinitionBegin{% + \def\markdownRendererDlDefinitionBegin{% + + ,\def\markdownRendererDlDefinitionBegin{, and }% + % + }% + } + }\def\markdownRendererDlItemEnd{} +\def\markdownRendererDlDefinitionEnd{} +\def\markdownRendererDlEnd{.} + +\markdownBegin + + This is a loose definition list + + Coffee + + : black hot drink + + : prepared from roasted coffee beans + + : one of the most traded agricultural commodities in the world + + Milk + + : white cold drink + + : nutrient-rich + + : produced on an industrial scale\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8511,90 +8523,90 @@ nutrient-rich, and produced on an industrial scale. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[definitionLists, tightLists]{markdown} -\begin{document} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {% - :\def\markdownRendererInterblockSeparator{\par}% - - },\begin{description}}, - dlBeginTight = {% - dlItem = {\item[#1] - \begin{itemize} - \def\markdownRendererDlDefinitionEnd{% - - ,\def\markdownRendererDlDefinitionEnd{% - - , and\def\markdownRendererDlDefinitionEnd{.}% - % - }% - } - },\end{itemize}}, - dlItemEnd = {\item, - dlDefinitionBegin = \end{description}}, - dlEndTight = { - }, - } - This is a tight definition list - - Coffee - : black hot drink - : prepared from roasted coffee beans - : one of the most traded agricultural commodities in the world - - Milk - : white cold drink - : nutrient-rich - : produced on an industrial scale\end{markdown*} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {\def\markdownRendererInterblockSeparator{\par}% - - }, - dlBegin = {},% - dlItem = { - . #1 is a\def\markdownRendererDlDefinitionBegin{% - \def\markdownRendererDlDefinitionBegin{% - - ,\def\markdownRendererDlDefinitionBegin{, and }% - % - }% - } - }, - dlItemEnd = {}, - dlDefinitionEnd = {}, - dlEnd = {.}, - }, - } - This is a loose definition list - - Coffee - - : black hot drink - - : prepared from roasted coffee beans - - : one of the most traded agricultural commodities in the world - - Milk - - : white cold drink - - : nutrient-rich - - : produced on an industrial scale\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[definitionLists, tightLists]{markdown} +\begin{document} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {% + :\def\markdownRendererInterblockSeparator{\par}% + + },\begin{description}}, + dlBeginTight = {% + dlItem = {\item[#1] + \begin{itemize} + \def\markdownRendererDlDefinitionEnd{% + + ,\def\markdownRendererDlDefinitionEnd{% + + , and\def\markdownRendererDlDefinitionEnd{.}% + % + }% + } + },\end{itemize}}, + dlItemEnd = {\item, + dlDefinitionBegin = \end{description}}, + dlEndTight = { + }, + } + This is a tight definition list + + Coffee + : black hot drink + : prepared from roasted coffee beans + : one of the most traded agricultural commodities in the world + + Milk + : white cold drink + : nutrient-rich + : produced on an industrial scale\end{markdown*} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {\def\markdownRendererInterblockSeparator{\par}% + + }, + dlBegin = {},% + dlItem = { + . #1 is a\def\markdownRendererDlDefinitionBegin{% + \def\markdownRendererDlDefinitionBegin{% + + ,\def\markdownRendererDlDefinitionBegin{, and }% + % + }% + } + }, + dlItemEnd = {}, + dlDefinitionEnd = {}, + dlEnd = {.}, + }, + } + This is a loose definition list + + Coffee + + : black hot drink + + : prepared from roasted coffee beans + + : one of the most traded agricultural commodities in the world + + Milk + + : white cold drink + + : nutrient-rich + + : produced on an industrial scale\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8620,90 +8632,90 @@ nutrient-rich, and produced on an industrial scale. class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown - - [ - definitionLists = yes, - tightLists = yes, - ]\starttext - -\def\markdownRendererInterblockSeparator{% -% - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBeginTight{} -\def\markdownRendererDlItem#1{% -\par{\bf#1}% - \startitemize - \def\markdownRendererDlDefinitionEnd{% - - ,\def\markdownRendererDlDefinitionEnd{% - - , and\def\markdownRendererDlDefinitionEnd{.}% - % - }% - } - }\def\markdownRendererDlItemEnd{\stopitemize} -\def\markdownRendererDlDefinitionBegin{\item} -\def\markdownRendererDlEndTight{} - -\startmarkdown - - This is a tight definition list - - Coffee - : black hot drink - : prepared from roasted coffee beans - : one of the most traded agricultural commodities in the world - - Milk - : white cold drink - : nutrient-rich - : produced on an industrial scale\stopmarkdown - -\def\markdownRendererInterblockSeparator{% -\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBegin{} -\def\markdownRendererDlItem#1{% - - . #1 is a\def\markdownRendererDlDefinitionBegin{% - \def\markdownRendererDlDefinitionBegin{% - - ,\def\markdownRendererDlDefinitionBegin{, and }% - % - }% - } - }\def\markdownRendererDlItemEnd{} -\def\markdownRendererDlDefinitionEnd{} -\def\markdownRendererDlEnd{.} - -\startmarkdown - - This is a loose definition list - - Coffee - - : black hot drink - - : prepared from roasted coffee beans - - : one of the most traded agricultural commodities in the world - - Milk - - : white cold drink - - : nutrient-rich - - : produced on an industrial scale\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown + + [ + definitionLists = yes, + tightLists = yes, + ]\starttext + +\def\markdownRendererInterblockSeparator{% +% + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBeginTight{} +\def\markdownRendererDlItem#1{% +\par{\bf#1}% + \startitemize + \def\markdownRendererDlDefinitionEnd{% + + ,\def\markdownRendererDlDefinitionEnd{% + + , and\def\markdownRendererDlDefinitionEnd{.}% + % + }% + } + }\def\markdownRendererDlItemEnd{\stopitemize} +\def\markdownRendererDlDefinitionBegin{\item} +\def\markdownRendererDlEndTight{} + +\startmarkdown + + This is a tight definition list + + Coffee + : black hot drink + : prepared from roasted coffee beans + : one of the most traded agricultural commodities in the world + + Milk + : white cold drink + : nutrient-rich + : produced on an industrial scale\stopmarkdown + +\def\markdownRendererInterblockSeparator{% +\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBegin{} +\def\markdownRendererDlItem#1{% + + . #1 is a\def\markdownRendererDlDefinitionBegin{% + \def\markdownRendererDlDefinitionBegin{% + + ,\def\markdownRendererDlDefinitionBegin{, and }% + % + }% + } + }\def\markdownRendererDlItemEnd{} +\def\markdownRendererDlDefinitionEnd{} +\def\markdownRendererDlEnd{.} + +\startmarkdown + + This is a loose definition list + + Coffee + + : black hot drink + + : prepared from roasted coffee beans + + : one of the most traded agricultural commodities in the world + + Milk + + : white cold drink + + : nutrient-rich + + : produced on an industrial scale\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8735,17 +8747,17 @@ enabled. The macro receives no arguments. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionSmartEllipses{true} -\def\markdownRendererEllipsis{{\it SHAZAM}!} -\markdownBegin - - The secret word is ...\markdownEnd -\bye
\input markdown +\def\markdownOptionSmartEllipses{true} +\def\markdownRendererEllipsis{{\it SHAZAM}!} +\markdownBegin + + The secret word is ...\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8755,22 +8767,22 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[smartEllipses]{markdown} -\markdownSetup{ - - renderers = {\emph{SHAZAM}!, - ellipsis = - }, - }\begin{document} -\begin{markdown} - - The secret word is ...\end{markdown} -\end{document}
\documentclass{article} +\usepackage[smartEllipses]{markdown} +\markdownSetup{ + + renderers = {\emph{SHAZAM}!, + ellipsis = + }, + }\begin{document} +\begin{markdown} + + The secret word is ...\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8780,18 +8792,18 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[smartEllipses = yes] -\def\markdownRendererEllipsis{\emph{SHAZAM}!} -\starttext -\startmarkdown - - The secret word is ...\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[smartEllipses = yes] +\def\markdownRendererEllipsis{\emph{SHAZAM}!} +\starttext +\startmarkdown + + The secret word is ...\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8808,19 +8820,19 @@ corresponds to the emphasized span of text. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererEmphasis#1{{\it#1}} -\def\markdownRendererStrongEmphasis#1{{\bf#1}} -\markdownBegin - - This is *emphasis*. - - This is **strong emphasis**.\markdownEnd -\bye
\input markdown +\def\markdownRendererEmphasis#1{{\it#1}} +\def\markdownRendererStrongEmphasis#1{{\bf#1}} +\markdownBegin + + This is *emphasis*. + + This is **strong emphasis**.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8831,25 +8843,25 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {\emph{#1}}, - emphasis = {\textbf{#1}}, - strongEmphasis = { - }, - }\begin{document} -\begin{markdown} - - This is *emphasis*. - - This is **strong emphasis**.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {\emph{#1}}, + emphasis = {\textbf{#1}}, + strongEmphasis = { + }, + }\begin{document} +\begin{markdown} + + This is *emphasis*. + + This is **strong emphasis**.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8860,20 +8872,20 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererEmphasis#1{\emph{#1}} -\def\markdownRendererStrongEmphasis#1{\bold{#1}} -\starttext -\startmarkdown - - This is *emphasis*. - - This is **strong emphasis**.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererEmphasis#1{\emph{#1}} +\def\markdownRendererStrongEmphasis#1{\bold{#1}} +\starttext +\startmarkdown + + This is *emphasis*. + + This is **strong emphasis**.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8897,40 +8909,40 @@ of a fenced code apply. The macros receive no arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[fencedCode, -markdown} - fencedCodeAttributes]{\usepackage{minted} -\markdownSetup{ - - renderers = {% - fencedCodeAttributeContextBegin = {\begingroup - \markdownSetup{ - - renderers = {% - attributeKeyValue = {\setminted{{#1} = {#2}}% - - }, - },% - } - },% - fencedCodeAttributeContextEnd = {\endgroup - - }, - }, - }\begin{document} -\begin{markdown} - - ~~~ js {linenos=true} - if (a > 3) { - moveShip(5 * gravity, DOWN); - } - ~~~~~~\end{markdown} -\end{document}
\documentclass{article} +\usepackage[fencedCode, +markdown} + fencedCodeAttributes]{\usepackage{minted} +\markdownSetup{ + + renderers = {% + fencedCodeAttributeContextBegin = {\begingroup + \markdownSetup{ + + renderers = {% + attributeKeyValue = {\setminted{{#1} = {#2}}% + + }, + },% + } + },% + fencedCodeAttributeContextEnd = {\endgroup + + }, + }, + }\begin{document} +\begin{markdown} + + ~~~ js {linenos=true} + if (a > 3) { + moveShip(5 * gravity, DOWN); + } + ~~~~~~\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8951,49 +8963,49 @@ the div apply. The macros receive no arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[fencedDivs]{markdown} -\markdownSetup{ - - renderers = {% - fencedDivAttributeContextBegin = {\par - \emph{(The beginning of a fenced div attribute context)} - \par - - },% - fencedDivAttributeContextEnd = {\par - \emph{(The end of a fenced div attribute context)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - - ::: {key=value} - - foo - - :::: {#identifier} - - bar - - :::: - - ::: - - ::: {.class_name} - - baz - - ::: -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[fencedDivs]{markdown} +\markdownSetup{ + + renderers = {% + fencedDivAttributeContextBegin = {\par + \emph{(The beginning of a fenced div attribute context)} + \par + + },% + fencedDivAttributeContextEnd = {\par + \emph{(The end of a fenced div attribute context)} + \par + + }, + }, + }\begin{document} +\begin{markdown} + + + ::: {key=value} + + foo + + :::: {#identifier} + + bar + + :::: + + ::: + + ::: {.class_name} + + baz + + ::: +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9020,37 +9032,37 @@ heading apply. The macros receive no arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes]{markdown} -\markdownSetup{ - - renderers = {% - headerAttributeContextBegin = {\par - \emph{(The beginning of a header attribute context)} - \par - - },% - headerAttributeContextEnd = {\par - \emph{(The end of a header attribute context)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - - # First top-level heading - - ## A subheading {#identifier} - - # Second top-level heading {.class_name} -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[headerAttributes]{markdown} +\markdownSetup{ + + renderers = {% + headerAttributeContextBegin = {\par + \emph{(The beginning of a header attribute context)} + \par + + },% + headerAttributeContextEnd = {\par + \emph{(The end of a header attribute context)} + \par + + }, + }, + }\begin{document} +\begin{markdown} + + + # First top-level heading + + ## A subheading {#identifier} + + # Second top-level heading {.class_name} +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9086,26 +9098,26 @@ the heading text. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererHeadingOne{1} -\def\markdownRendererHeadingTwo{2} -\def\markdownRendererHeadingThree{3} -\def\markdownRendererHeadingFour{4} -\def\markdownRendererHeadingFive{5} -\def\markdownRendererHeadingSix{6} -\markdownBegin - - ###### - ##### - ##### - ### - ######\markdownEnd -\bye
\input markdown +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererHeadingOne{1} +\def\markdownRendererHeadingTwo{2} +\def\markdownRendererHeadingThree{3} +\def\markdownRendererHeadingFour{4} +\def\markdownRendererHeadingFive{5} +\def\markdownRendererHeadingSix{6} +\markdownBegin + + ###### + ##### + ##### + ### + ######\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9115,32 +9127,32 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = { - interblockSeparator = {}, - headingOne = 1, - headingTwo = 2, - headingThree = 3, - headingFour = 4, - headingFive = 5, - headingSix = 6, - }, - }\begin{document} -\begin{markdown} - - ###### - ##### - ##### - ### - ######\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + interblockSeparator = {}, + headingOne = 1, + headingTwo = 2, + headingThree = 3, + headingFour = 4, + headingFive = 5, + headingSix = 6, + }, + }\begin{document} +\begin{markdown} + + ###### + ##### + ##### + ### + ######\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9150,27 +9162,27 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererHeadingOne{1} -\def\markdownRendererHeadingTwo{2} -\def\markdownRendererHeadingThree{3} -\def\markdownRendererHeadingFour{4} -\def\markdownRendererHeadingFive{5} -\def\markdownRendererHeadingSix{6} -\starttext -\startmarkdown - - ###### - ##### - ##### - ### - ######\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererHeadingOne{1} +\def\markdownRendererHeadingTwo{2} +\def\markdownRendererHeadingThree{3} +\def\markdownRendererHeadingFour{4} +\def\markdownRendererHeadingFive{5} +\def\markdownRendererHeadingSix{6} +\starttext +\startmarkdown + + ###### + ##### + ##### + ### + ######\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9192,36 +9204,36 @@ receive no arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
+document.tex
with the following content:+\documentclass{article} +\usepackage[html]{markdown} +\usepackage{marginnote} +\markdownSetup{ + + renderers = {\marginnote{#1}}, + inlineHtmlComment = {\begin{quote}}, + blockHtmlCommentBegin = {\end{quote}}, + blockHtmlCommentEnd = { + }, + }\begin{document} +\begin{markdown} + + A useful use of inline HTML comments are side notes. + <!-- Side notes are displayed in the horizontal margins next to the relevant + passages, which makes them *easier for the reader to find* than notes. --> + + We can render block HTML comments as blockquotes: + + <!-- + Here is a block HTML comment with a code example that a programmer might understand: + + foo = bar + baz - 42 + -->\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-\documentclass{article} -\usepackage[html]{markdown} -\usepackage{marginnote} -\markdownSetup{ - - renderers = {\marginnote{#1}}, - inlineHtmlComment = {\begin{quote}}, - blockHtmlCommentBegin = {\end{quote}}, - blockHtmlCommentEnd = { - }, - }\begin{document} -\begin{markdown} - - A useful use of inline HTML comments are side notes. - <!-- Side notes are displayed in the horizontal margins next to the relevant - passages, which makes them *easier for the reader to find* than notes. --> - - We can render block HTML comments as blockquotes: - - <!-- - Here is a block HTML comment with a code example that a programmer might understand: - - foo = bar + baz - 42 - -->\end{markdown} -\end{document}
Next, invoke LuaTeX from the terminal:
-+class="sourceCode sh">lualatex document.tex -lualatex document.tex
lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following body text:@@ -9256,28 +9268,28 @@ the contents of the HTML element. class="latex">LaTeX ExampleUsing a text editor, create a text document named
+document.tex
with the following content:+\documentclass{article} +\usepackage[html]{markdown} +\usepackage{marginnote} +\usepackage{verbatim} +\markdownSetup{ + + renderers = {\textbf{#1}}, + inlineHtmlTag = {\verbatiminput{#1}}, + inputBlockHtmlElement = { + }, + }\begin{document} +\begin{markdown} + + <b>_Hello,_ world!</b><br/> + + <div>_Hello,_ world!</div>\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-\documentclass{article} -\usepackage[html]{markdown} -\usepackage{marginnote} -\usepackage{verbatim} -\markdownSetup{ - - renderers = {\textbf{#1}}, - inlineHtmlTag = {\verbatiminput{#1}}, - inputBlockHtmlElement = { - }, - }\begin{document} -\begin{markdown} - - <b>_Hello,_ world!</b><br/> - - <div>_Hello,_ world!</div>\end{markdown} -\end{document}
Next, invoke LuaTeX from the terminal:
-+class="sourceCode sh">lualatex document.tex -lualatex document.tex
lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following body text:@@ -9294,44 +9306,44 @@ outside typesetting, and the title of the link. class="latex">LaTeX ExampleUsing a text editor, create a text document named
+document.tex
with the following content:\documentclass{article} +\usepackage{markdown} +\begingroup +\catcode`\@=11 +\catcode`\%=12 +\catcode`\^^A=14 +\global\def\markdownRendererImage#1#2#3#4{^^A +\immediate\write18{^^A
+class="sourceCode sh">\documentclass{article} -\usepackage{markdown} -\begingroup -\catcode`\@=11 -\catcode`\%=12 -\catcode`\^^A=14 -\global\def\markdownRendererImage#1#2#3#4{^^A -\immediate\write18{^^A
if printf '%s' "#3" | grep -q ^http; then + OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A + $(printf '%s' "#3" | sed 's/.*[.]//')"; + if ! [ -e "$OUTPUT" ]; then + wget -O "$OUTPUT" '#3' || rm "$OUTPUT"; + convert "$OUTPUT" png:"$OUTPUT"; + fi; + printf '%s%%' "$OUTPUT" > \jobname.fetched; + else + printf '%s%%' "#3" > \jobname.fetched; + fi^^A
-if printf '%s' "#3" | grep -q ^http; then - OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A - $(printf '%s' "#3" | sed 's/.*[.]//')"; -if ! [ -e "$OUTPUT" ]; then - wget -O "$OUTPUT" '#3' || rm "$OUTPUT"; - convert "$OUTPUT" png:"$OUTPUT"; - fi; - printf '%s%%' "$OUTPUT" > \jobname.fetched; - else - printf '%s%%' "#3" > \jobname.fetched; - fi^^A
+class="sourceCode tex">- }^^A - {^^A\everyeof={\noexpand}^^A - \edef\filename{\__markdowninput"\jobname.fetched" }^^A - \includegraphics[width=\textwidth]{\filename}^^A - - }^^A - }\endgroup -\begin{document} -\begin{markdown} - - \end{markdown} -\end{document}
}^^A + {^^A + \everyeof={\noexpand}^^A + \edef\filename{\__markdowninput"\jobname.fetched" }^^A + \includegraphics[width=\textwidth]{\filename}^^A + }^^A +} +\endgroup +\begin{document} +\begin{markdown} + +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
class="latex">LaTeX Exampledocument.pdf
should be produced and contain the following content. This assumes that you use a Unix-like operating system with Bourne or Bourne again shell as the default shell @@ -9359,26 +9371,26 @@ image apply. The macros receive no arguments.Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[linkAttributes]{markdown} -\markdownSetup{ - - renderers = { - imageAttributeContextBegin = {(}, - image = {#1}, - imageAttributeContextEnd = {)}, - }, - }\begin{document} -\begin{markdown} - - - foo {key=value} baz -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[linkAttributes]{markdown} +\markdownSetup{ + + renderers = { + imageAttributeContextBegin = {(}, + image = {#1}, + imageAttributeContextEnd = {)}, + }, + }\begin{document} +\begin{markdown} + + + foo {key=value} baz +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9394,22 +9406,22 @@ receives no arguments. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererInterblockSeparator{% -\par - \it(The end of a block)}% - {\par - - }\markdownBegin - - Hello *world*! - - _Foo_ bar!\markdownEnd -\bye
\input markdown +\def\markdownRendererInterblockSeparator{% +\par + \it(The end of a block)}% + {\par + + }\markdownBegin + + Hello *world*! + + _Foo_ bar!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9421,28 +9433,28 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - interblockSeparator = {\par - \emph{(The end of a block)}% - \par - - }, - }, - }\begin{document} -\begin{markdown} - - Hello *world*! - - _Foo_ bar!\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + interblockSeparator = {\par + \emph{(The end of a block)}% + \par + + }, + }, + }\begin{document} +\begin{markdown} + + Hello *world*! + + _Foo_ bar!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9454,23 +9466,23 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererInterblockSeparator{% -\par - \emph{(The end of a block)}% - \par - - }\starttext -\startmarkdown - - Hello *world*! - - _Foo_ bar!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererInterblockSeparator{% +\par + \emph{(The end of a block)}% + \par + + }\starttext +\startmarkdown + + Hello *world*! + + _Foo_ bar!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9490,19 +9502,19 @@ arguments. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionLineBlocks{true} -\markdownBegin - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\markdownEnd -\bye
\input markdown +\def\markdownOptionLineBlocks{true} +\markdownBegin + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9515,20 +9527,20 @@ Tread softly because you tread on my dreams. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[lineBlocks]{markdown} -\begin{document} -\begin{markdown} - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[lineBlocks]{markdown} +\begin{document} +\begin{markdown} + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9541,20 +9553,20 @@ Tread softly because you tread on my dreams. class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[lineBlocks = yes] -\starttext -\startmarkdown - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[lineBlocks = yes] +\starttext +\startmarkdown + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9571,15 +9583,15 @@ hard line break. The macro receives no arguments. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererHardLineBreak{% -\par - \it(A hard line break)}% - {\par - - }\markdownInput{example.md} -\bye
\input markdown +\def\markdownRendererHardLineBreak{% +\par + \it(A hard line break)}% + {\par + + }\markdownInput{example.md} +\bye
Using a text editor, create a text document named
example.md
with the following content. Note the two spaces at the end of the first line, which specify a hard line break. Due to @@ -9588,8 +9600,8 @@ processor, hard line breaks would be ignored if we typed them directly into thedocument.tex
document.Hello world!
_Foo_ bar!Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9601,21 +9613,21 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - hardLineBreak = {\par - \emph{(A hard line break)}% - \par - - }, - }, - }\begin{document} -\markdownInput{example.md} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + hardLineBreak = {\par + \emph{(A hard line break)}% + \par + + }, + }, + }\begin{document} +\markdownInput{example.md} +\end{document}
Using a text editor, create a text document named
example.md
with the following content. Note the two spaces at the end of the first line, which specify a hard line break. Due to @@ -9624,8 +9636,8 @@ processor, hard line breaks would be ignored if we typed them directly into thedocument.tex
document.Hello world!
_Foo_ bar!Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9643,21 +9655,21 @@ that can be used outside typesetting, and the title of the link. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererLink#1#2#3#4{% -\tt#2} titled {\it#4}% - #1 { - }\markdownBegin - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\markdownEnd -\bye
\input markdown +\def\markdownRendererLink#1#2#3#4{% +\tt#2} titled {\it#4}% + #1 { + }\markdownBegin + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9669,27 +9681,27 @@ Archive Network. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - link = {\texttt{#2} titled \emph{#4}% - #1 - }, - }, - }\begin{document} -\begin{markdown} - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + link = {\texttt{#2} titled \emph{#4}% + #1 + }, + }, + }\begin{document} +\begin{markdown} + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9701,22 +9713,22 @@ Archive Network. class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererLink#1#2#3#4{% -\tt#2} titled \emph{#4}% - #1 { - }\starttext -\startmarkdown - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererLink#1#2#3#4{% +\tt#2} titled \emph{#4}% + #1 { + }\starttext +\startmarkdown + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9737,26 +9749,26 @@ hyperlink apply. The macros receive no arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[linkAttributes]{markdown} -\markdownSetup{ - - renderers = { - linkAttributeContextBegin = {(}, - link = {#1}, - linkAttributeContextEnd = {)}, - }, - }\begin{document} -\begin{markdown} - - - foo [bar](#bar){key=value} baz -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[linkAttributes]{markdown} +\markdownSetup{ + + renderers = { + linkAttributeContextBegin = {(}, + link = {#1}, + linkAttributeContextEnd = {)}, + }, + }\begin{document} +\begin{markdown} + + + foo [bar](#bar){key=value} baz +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9778,77 +9790,77 @@ account. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-nested.md
with the following content:+This is a *nested* markdown document.
This is a *nested* markdown document.
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[contentBlocks]{markdown} -\markdownSetup{ - - renderers = {% - contentBlock = {\markdownInput{#3}% - - },% - documentBegin = {\par - \emph{(The beginning of a document)} - \par - \begingroup - \markdownSetup{snippet=first-nesting-level}% - - },% - documentEnd = {\endgroup - \par - \emph{(The end of a document)} - \par - - }, - }, - }\markdownSetupSnippet{first-nesting-level}{ - - renderers = { - documentBegin = {\par - \emph{(The beginning of a nested document)} - \par - \begingroup - \markdownSetup{snippet=second-nesting-level-and-below} - - }, - }, - }\markdownSetupSnippet{second-nesting-level-and-below}{ - - renderers = { - documentBegin = {\par - \emph{(The beginning of a nested document)} - \par - \begingroup - - }, - documentEnd = {\endgroup - \par - \emph{(The end of a nested document)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - Hello *world*! - - /nested.md - - _Foo_ bar!\end{markdown} -\begin{markdown} - - - Bar baz! -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[contentBlocks]{markdown} +\markdownSetup{ + + renderers = {% + contentBlock = {\markdownInput{#3}% + + },% + documentBegin = {\par + \emph{(The beginning of a document)} + \par + \begingroup + \markdownSetup{snippet=first-nesting-level}% + + },% + documentEnd = {\endgroup + \par + \emph{(The end of a document)} + \par + + }, + }, + }\markdownSetupSnippet{first-nesting-level}{ + + renderers = { + documentBegin = {\par + \emph{(The beginning of a nested document)} + \par + \begingroup + \markdownSetup{snippet=second-nesting-level-and-below} + + }, + }, + }\markdownSetupSnippet{second-nesting-level-and-below}{ + + renderers = { + documentBegin = {\par + \emph{(The beginning of a nested document)} + \par + \begingroup + + }, + documentEnd = {\endgroup + \par + \emph{(The end of a nested document)} + \par + + }, + }, + }\begin{document} +\begin{markdown} + + Hello *world*! + + /nested.md + + _Foo_ bar!\end{markdown} +\begin{markdown} + + + Bar baz! +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9872,42 +9884,42 @@ non-breaking space. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.bib
with the following content:+@book{knuth:tex, -author = "Knuth, Donald Ervin", - title = "The \TeX book, volume A of Computers and typesetting", - publisher = "Addison-Wesley", - year = "1984" - }
@book{knuth:tex, +author = "Knuth, Donald Ervin", + title = "The \TeX book, volume A of Computers and typesetting", + publisher = "Addison-Wesley", + year = "1984" + }
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[ - - citations, - citationNbsps,markdown} - ]{\markdownSetup{ - - renderers = {$\cdot$}, - nbsp = { - }, - }\begin{document} - -\begin{markdown} - - The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} - -\bibliographystyle{plain} -\bibliography{document.bib} - -\end{document}
\documentclass{article} +\usepackage[ + + citations, + citationNbsps,markdown} + ]{\markdownSetup{ + + renderers = {$\cdot$}, + nbsp = { + }, + }\begin{document} + +\begin{markdown} + + The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} + +\bibliographystyle{plain} +\bibliography{document.bib} + +\end{document}
Next, invoke LuaTeX and BibTeX from the terminal:
-+lualatex document.tex -bibtex document.aux -lualatex document.tex -lualatex document.tex
lualatex document.tex +bibtex document.aux +lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9928,21 +9940,21 @@ receives a single argument that corresponds to the note text. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionNotes{true} -\def\markdownRendererNote#1{ (and \lowercase{#1})} -\markdownBegin - - This is some text[^1] and this is some other text[^2]. - - [^1]: this is a note - - [^2]: this is some other note\markdownEnd -\bye
\input markdown +\def\markdownOptionNotes{true} +\def\markdownRendererNote#1{ (and \lowercase{#1})} +\markdownBegin + + This is some text[^1] and this is some other text[^2]. + + [^1]: this is a note + + [^2]: this is some other note\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9953,26 +9965,26 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[notes]{markdown} -\markdownSetup{ - - renderers = {\MakeLowercase{#1})}, - note = { (and - }, - }\begin{document} -\begin{markdown} - - This is some text[^1] and this is some other text[^2]. - - [^1]: this is a note - - [^2]: this is some other note\end{markdown} -\end{document}
\documentclass{article} +\usepackage[notes]{markdown} +\markdownSetup{ + + renderers = {\MakeLowercase{#1})}, + note = { (and + }, + }\begin{document} +\begin{markdown} + + This is some text[^1] and this is some other text[^2]. + + [^1]: this is a note + + [^2]: this is some other note\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9983,22 +9995,22 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[notes = yes] -\def\markdownRendererNote#1{ (and \lowercase{#1})} -\starttext -\startmarkdown - - This is some text[^1] and this is some other text[^2]. - - [^1]: this is a note - - [^2]: this is some other note\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[notes = yes] +\def\markdownRendererNote#1{ (and \lowercase{#1})} +\starttext +\startmarkdown + + This is some text[^1] and this is some other text[^2]. + + [^1]: this is a note + + [^2]: this is some other note\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10094,70 +10106,70 @@ receives no arguments. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionTightLists{true} -\def\markdownOptionStartNumber{true} - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererOlBeginTight{ (} -\def\markdownRendererOlItemWithNumber#1{% -\ifnum #1=1\relax - - the first\else - \ifnum #1=2\relax - - , the second\else - - , and the third\fi - \fi - - }\def\markdownRendererOlItemEnd{} -\def\markdownRendererOlEndTight{).} - -\markdownBegin - - This is a tight list - - 1. item - 2. item - 3. item\markdownEnd - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererOlBegin{} -\def\markdownRendererOlItemWithNumber#1{% -\kern 0.5em% - #1. - This is the\ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }\def\markdownRendererOlItemEnd{.\par} -\def\markdownRendererOlEnd{} - -\markdownBegin - - This is a loose list - - 1. item - - 2. item - - 3. item\markdownEnd - -\bye
\input markdown +\def\markdownOptionTightLists{true} +\def\markdownOptionStartNumber{true} + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererOlBeginTight{ (} +\def\markdownRendererOlItemWithNumber#1{% +\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }\def\markdownRendererOlItemEnd{} +\def\markdownRendererOlEndTight{).} + +\markdownBegin + + This is a tight list + + 1. item + 2. item + 3. item\markdownEnd + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererOlBegin{} +\def\markdownRendererOlItemWithNumber#1{% +\kern 0.5em% + #1. + This is the\ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }\def\markdownRendererOlItemEnd{.\par} +\def\markdownRendererOlEnd{} + +\markdownBegin + + This is a loose list + + 1. item + + 2. item + + 3. item\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10174,73 +10186,73 @@ item). class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[tightLists, startNumber]{markdown} -\begin{document} - -\begin{markdown*}{ - - renderers = { - interblockSeparator = {}, - olBeginTight = { (},% - olItemWithNumber = {\ifnum #1=1\relax - - the first\else - \ifnum #1=2\relax - - , the second\else - - , and the third\fi - \fi - - }, - olItemEnd = {}, - olEndTight = {).}, - }, - } - This is a tight list - - 1. item - 2. item - 3. item\end{markdown*} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {\par - :\def\markdownRendererInterblockSeparator{\par}% - - },\begin{enumerate}}, - olBeginTight = {% - olItemWithNumber = {\item This is the - \ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }, - olItemEnd = {.},\end{enumerate}}, - olEnd = { - }, - } - This is a loose list - - 1. item - - 2. item - - 3. item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[tightLists, startNumber]{markdown} +\begin{document} + +\begin{markdown*}{ + + renderers = { + interblockSeparator = {}, + olBeginTight = { (},% + olItemWithNumber = {\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }, + olItemEnd = {}, + olEndTight = {).}, + }, + } + This is a tight list + + 1. item + 2. item + 3. item\end{markdown*} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {\par + :\def\markdownRendererInterblockSeparator{\par}% + + },\begin{enumerate}}, + olBeginTight = {% + olItemWithNumber = {\item This is the + \ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }, + olItemEnd = {.},\end{enumerate}}, + olEnd = { + }, + } + This is a loose list + + 1. item + + 2. item + + 3. item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10257,74 +10269,74 @@ item). class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown - - [ - tightLists = yes, - startNumber = yes, - ]\starttext - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererOlBeginTight{ (} -\def\markdownRendererOlItemWithNumber#1{% -\ifnum #1=1\relax - - the first\else - \ifnum #1=2\relax - - , the second\else - - , and the third\fi - \fi - - }\def\markdownRendererOlItemEnd{} -\def\markdownRendererOlEndTight{).} - -\startmarkdown - - This is a tight list - - 1. item - 2. item - 3. item\stopmarkdown - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererOlBegin{\startitemize} -\def\markdownRendererOlItemWithNumber#1{% -\sym{#1.} - - This is the\ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }\def\markdownRendererOlItemEnd{.\par} -\def\markdownRendererOlEnd{\stopitemize} - -\startmarkdown - - This is a loose list - - 1. item - - 2. item - - 3. item\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown + + [ + tightLists = yes, + startNumber = yes, + ]\starttext + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererOlBeginTight{ (} +\def\markdownRendererOlItemWithNumber#1{% +\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }\def\markdownRendererOlItemEnd{} +\def\markdownRendererOlEndTight{).} + +\startmarkdown + + This is a tight list + + 1. item + 2. item + 3. item\stopmarkdown + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererOlBegin{\startitemize} +\def\markdownRendererOlItemWithNumber#1{% +\sym{#1.} + + This is the\ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }\def\markdownRendererOlItemEnd{.\par} +\def\markdownRendererOlEnd{\stopitemize} + +\startmarkdown + + This is a loose list + + 1. item + + 2. item + + 3. item\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10353,50 +10365,50 @@ author’s name is to be suppressed, or+
otherwise. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[citations]{markdown} -\newcount\citationsCounter -\newcount\citationsTotal -\makeatletter -\def\citations#1#2#3#4{% -\emph{#4} - a parenthesized citation \advance\citationsCounter by 1\relax - \ifx\relax#2\relax - \ifx\relax#3\relax\else - \emph{#3}% - with a postfix \fi - \else - \emph{#2}% - with a prefix \ifx\relax#3\relax\else - \ and a postfix \emph{#3}% - \fi - \fi - \ifnum\citationsCounter>\citationsTotal\relax - % - .\expandafter\@gobble - \else - - , and\fi\citations} - \makeatother -\markdownSetup{ - - renderers = {% - cite = {\citationsCounter=1% - \citationsTotal=#1% - - This is\expandafter\citations - - }, - }, - }\begin{document} -\begin{markdown} - - [see @abrahams90, pp. 12; @eijkhout91, pp. 34]\end{markdown} -\end{document}
\documentclass{article} +\usepackage[citations]{markdown} +\newcount\citationsCounter +\newcount\citationsTotal +\makeatletter +\def\citations#1#2#3#4{% +\emph{#4} + a parenthesized citation \advance\citationsCounter by 1\relax + \ifx\relax#2\relax + \ifx\relax#3\relax\else + \emph{#3}% + with a postfix \fi + \else + \emph{#2}% + with a prefix \ifx\relax#3\relax\else + \ and a postfix \emph{#3}% + \fi + \fi + \ifnum\citationsCounter>\citationsTotal\relax + % + .\expandafter\@gobble + \else + + , and\fi\citations} + \makeatother +\markdownSetup{ + + renderers = {% + cite = {\citationsCounter=1% + \citationsTotal=#1% + + This is\expandafter\citations + + }, + }, + }\begin{document} +\begin{markdown} + + [see @abrahams90, pp. 12; @eijkhout91, pp. 34]\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10422,41 +10434,41 @@ of the raw block. This macro will only be produced, when the class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[rawAttribute, fencedCode]{markdown} -\usepackage{expl3} -\ExplSyntaxOn -\cs_new:Nn -\display_raw_content:nn - - {% If the raw attribute is TeX, execute the content as a TeX document. - \str_if_eq:nnTF - - { #2 } - { tex }\markdownEscape { #1 } } - { % Otherwise, ignore the content. - - { } - }\markdownSetup{ - - renderers = {\display_raw_content:nn { #1 } { #2 } }, - rawInline = { \display_raw_content:nn { #1 } { #2 } } - rawBlock = { - }, - }\ExplSyntaxOff -\begin{document} -\begin{markdown} -$H_2 O$`{=tex} is a liquid. - ` - - ``` {=html} - <p>Here is some HTML content that will be ignored.</p> - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage[rawAttribute, fencedCode]{markdown} +\usepackage{expl3} +\ExplSyntaxOn +\cs_new:Nn +\display_raw_content:nn + + {% If the raw attribute is TeX, execute the content as a TeX document. + \str_if_eq:nnTF + + { #2 } + { tex }\markdownEscape { #1 } } + { % Otherwise, ignore the content. + + { } + }\markdownSetup{ + + renderers = {\display_raw_content:nn { #1 } { #2 } }, + rawInline = { \display_raw_content:nn { #1 } { #2 } } + rawBlock = { + }, + }\ExplSyntaxOff +\begin{document} +\begin{markdown} +$H_2 O$`{=tex} is a liquid. + ` + + ``` {=html} + <p>Here is some HTML content that will be ignored.</p> + ```\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10511,16 +10523,16 @@ class="tex">TeX Example tilde behave as if it were written in TeX, where it represents a non-breaking space. -+\input markdown -\def\markdownRendererTilde{~} -\markdownBegin - - Bartel~Leendert van~der~Waerden\markdownEnd -\bye
\input markdown +\def\markdownRendererTilde{~} +\markdownBegin + + Bartel~Leendert van~der~Waerden\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
@@ -10534,22 +10546,22 @@ class="latex">LaTeX Example tilde behave as if it were written in TeX, where it represents a non-breaking space. -document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = { - tilde = ~, - }, - }\begin{document} -\begin{markdown} - - Bartel~Leendert van~der~Waerden\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + tilde = ~, + }, + }\begin{document} +\begin{markdown} + + Bartel~Leendert van~der~Waerden\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
@@ -10563,17 +10575,17 @@ class="tex">TeXt Example tilde behave as if it were written in TeX, where it represents a non-breaking space. -document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:+\usemodule[t][markdown] -\def\markdownRendererTilde{~} -\starttext -\startmarkdown - - Bartel~Leendert van~der~Waerden\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererTilde{~} +\starttext +\startmarkdown + + Bartel~Leendert van~der~Waerden\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
@@ -10592,18 +10604,18 @@ enabled. class="tex">TeX Exampledocument.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionStrikeThrough{true} -\input soulutf8.sty -\def\markdownRendererStrikeThrough#1{\st{#1}} -\markdownBegin - - This is ~~a lunar roving vehicle~~ strike-through text.\markdownEnd -\bye
\input markdown +\def\markdownOptionStrikeThrough{true} +\input soulutf8.sty +\def\markdownRendererStrikeThrough#1{\st{#1}} +\markdownBegin + + This is ~~a lunar roving vehicle~~ strike-through text.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10613,23 +10625,23 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[strikeThrough]{markdown} -\usepackage{soulutf8} -\markdownSetup{ - - renderers = {\st{#1}}, - strikeThrough = { - }, - }\begin{document} -\begin{markdown} - - This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[strikeThrough]{markdown} +\usepackage{soulutf8} +\markdownSetup{ + + renderers = {\st{#1}}, + strikeThrough = { + }, + }\begin{document} +\begin{markdown} + + This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10639,18 +10651,18 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[strikeThrough = yes] -\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} -\starttext -\startmarkdown - - This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[strikeThrough = yes] +\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} +\starttext +\startmarkdown + + This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10667,17 +10679,17 @@ enabled. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionSubscripts{true} -\def\markdownRendererSubscript#1{ (#1 moles) and } -\markdownBegin - - H~2~O is a liquid.\markdownEnd -\bye
\input markdown +\def\markdownOptionSubscripts{true} +\def\markdownRendererSubscript#1{ (#1 moles) and } +\markdownBegin + + H~2~O is a liquid.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10687,22 +10699,22 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[subscripts]{markdown} -\markdownSetup{ - - renderers = { - subscript = { (#1 moles) and }, - }, - }\begin{document} -\begin{markdown} - - H~2~O is a liquid.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[subscripts]{markdown} +\markdownSetup{ + + renderers = { + subscript = { (#1 moles) and }, + }, + }\begin{document} +\begin{markdown} + + H~2~O is a liquid.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10712,18 +10724,18 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[subscripts = yes] -\def\markdownRendererSubscript#1{ (#1 moles) and } -\starttext -\startmarkdown - - H~2~O is a liquid.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[subscripts = yes] +\def\markdownRendererSubscript#1{ (#1 moles) and } +\starttext +\startmarkdown + + H~2~O is a liquid.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10740,17 +10752,17 @@ enabled. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionSuperscripts{true} -\def\markdownRendererSuperscript#1{ taken to the power of #1} -\markdownBegin - - 2^10^ is 1024.\markdownEnd -\bye
\input markdown +\def\markdownOptionSuperscripts{true} +\def\markdownRendererSuperscript#1{ taken to the power of #1} +\markdownBegin + + 2^10^ is 1024.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10760,22 +10772,22 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[superscripts]{markdown} -\markdownSetup{ - - renderers = { - superscript = { taken to the power of #1}, - }, - }\begin{document} -\begin{markdown} - - 2^10^ is 1024.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[superscripts]{markdown} +\markdownSetup{ + + renderers = { + superscript = { taken to the power of #1}, + }, + }\begin{document} +\begin{markdown} + + 2^10^ is 1024.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10785,18 +10797,18 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[superscripts = yes] -\def\markdownRendererSuperscript#1{ taken to the power of #1} -\starttext -\startmarkdown - - 2^10^ is 1024.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[superscripts = yes] +\def\markdownRendererSuperscript#1{ taken to the power of #1} +\starttext +\startmarkdown + + 2^10^ is 1024.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10828,67 +10840,67 @@ one of the following: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[pipeTables, tableCaptions]{markdown} -\newcount\rowCounter -\newcount\columnCounter -\makeatletter -\def\processRow#1{% -\columnCounter=1% - \ifnum\rowCounter=0\relax - - As for the alignment,\else - \the\rowCounter, - In row \fi - \processColumn#1 - \advance\rowCounter by 1\relax - \ifnum\rowCounter>\rowTotal\relax - \expandafter\@gobble - \fi\processRow}% - \def\processColumn#1{% -\the\columnCounter{} - column number \ifnum\rowCounter=0\relax - \if#1d{}has default alignment\fi - \if#1l{}is left-aligned\fi - \if#1c{}is centered\fi - \if#1r{}is right-aligned\fi - \else - \emph{#1}% - says \fi - \advance\columnCounter by 1\relax - \ifnum\columnCounter<\columnTotal\relax, \fi - \ifnum\columnCounter=\columnTotal\relax, and \fi - \ifnum\columnCounter>\columnTotal\relax - \expandafter\@gobble - .\fi\processColumn}% - \makeatother -\markdownSetup{ - - renderers = {% - table = {\emph{#1} that is #3 colums wide - This is a table with caption - and #2 rows long.\rowCounter=0% - \def\rowTotal{#2}% - \def\columnTotal{#3}% - \processRow - - }, - }, - }\begin{document} -\begin{markdown} - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 | - - : Demonstration of pipe table syntax\end{markdown} -\end{document}
\documentclass{article} +\usepackage[pipeTables, tableCaptions]{markdown} +\newcount\rowCounter +\newcount\columnCounter +\makeatletter +\def\processRow#1{% +\columnCounter=1% + \ifnum\rowCounter=0\relax + + As for the alignment,\else + \the\rowCounter, + In row \fi + \processColumn#1 + \advance\rowCounter by 1\relax + \ifnum\rowCounter>\rowTotal\relax + \expandafter\@gobble + \fi\processRow}% + \def\processColumn#1{% +\the\columnCounter{} + column number \ifnum\rowCounter=0\relax + \if#1d{}has default alignment\fi + \if#1l{}is left-aligned\fi + \if#1c{}is centered\fi + \if#1r{}is right-aligned\fi + \else + \emph{#1}% + says \fi + \advance\columnCounter by 1\relax + \ifnum\columnCounter<\columnTotal\relax, \fi + \ifnum\columnCounter=\columnTotal\relax, and \fi + \ifnum\columnCounter>\columnTotal\relax + \expandafter\@gobble + .\fi\processColumn}% + \makeatother +\markdownSetup{ + + renderers = {% + table = {\emph{#1} that is #3 colums wide + This is a table with caption + and #2 rows long.\rowCounter=0% + \def\rowTotal{#2}% + \def\columnTotal{#3}% + \processRow + + }, + }, + }\begin{document} +\begin{markdown} + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 | + + : Demonstration of pipe table syntax\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10921,20 +10933,20 @@ enabled. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionTexMathDollars{true} -\def\markdownRendererInlineMath#1{$#1\dots$} -\def\markdownRendererDisplayMath#1{$$#1\eqno(1)$$} -\markdownBegin -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\markdownEnd -\bye
\input markdown +\def\markdownOptionTexMathDollars{true} +\def\markdownRendererInlineMath#1{$#1\dots$} +\def\markdownRendererDisplayMath#1{$$#1\eqno(1)$$} +\markdownBegin +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10948,22 +10960,22 @@ dx\eqno(1)$$ class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[texMathDollars]{markdown} -\usepackage{amsmath} -\def\markdownRendererInlineMath#1{\begin{math}#1\dots\end{math}} -\def\markdownRendererDisplayMath#1{\begin{equation}#1\end{equation}} -\begin{document} -\begin{markdown} -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[texMathDollars]{markdown} +\usepackage{amsmath} +\def\markdownRendererInlineMath#1{\begin{math}#1\dots\end{math}} +\def\markdownRendererDisplayMath#1{\begin{equation}#1\end{equation}} +\begin{document} +\begin{markdown} +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10976,21 +10988,21 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texMathDollars = yes] -\def\markdownRendererInlineMath#1{$#1\dots$}% -\def\markdownRendererDisplayMath#1{\placeformula\startformula#1\stopformula}% -\starttext -\startmarkdown -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[texMathDollars = yes] +\def\markdownRendererInlineMath#1{$#1\dots$}% +\def\markdownRendererDisplayMath#1{\placeformula\startformula#1\stopformula}% +\starttext +\startmarkdown +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11011,50 +11023,50 @@ receives parameters in the same format as the class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[citations]{markdown} -\newcount\citationsCounter -\newcount\citationsTotal -\makeatletter -\def\citations#1#2#3#4{% -\emph{#4} - a text citation \advance\citationsCounter by 1\relax - \ifx\relax#2\relax - \ifx\relax#3\relax\else - \emph{#3}% - with a postfix \fi - \else - \emph{#2}% - with a prefix \ifx\relax#3\relax\else - \ and a postfix \emph{#3}% - \fi - \fi - \ifnum\citationsCounter>\citationsTotal\relax - % - .\expandafter\@gobble - \else - - , and\fi\citations} - \makeatother -\markdownSetup{ - - renderers = {% - textCite = {\citationsCounter=1% - \citationsTotal=#1% - - This is\expandafter\citations - - }, - }, - }\begin{document} -\begin{markdown} - - @abrahams90 [pp. 12; also @eijkhout91]\end{markdown} -\end{document}
\documentclass{article} +\usepackage[citations]{markdown} +\newcount\citationsCounter +\newcount\citationsTotal +\makeatletter +\def\citations#1#2#3#4{% +\emph{#4} + a text citation \advance\citationsCounter by 1\relax + \ifx\relax#2\relax + \ifx\relax#3\relax\else + \emph{#3}% + with a postfix \fi + \else + \emph{#2}% + with a prefix \ifx\relax#3\relax\else + \ and a postfix \emph{#3}% + \fi + \fi + \ifnum\citationsCounter>\citationsTotal\relax + % + .\expandafter\@gobble + \else + + , and\fi\citations} + \makeatother +\markdownSetup{ + + renderers = {% + textCite = {\citationsCounter=1% + \citationsTotal=#1% + + This is\expandafter\citations + + }, + }, + }\begin{document} +\begin{markdown} + + @abrahams90 [pp. 12; also @eijkhout91]\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11071,20 +11083,20 @@ thematic break. The macro receives no arguments. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererThematicBreak{\vfil\break} -\markdownBegin - - This is the first page. - - *** - - This is the second page.\markdownEnd -\bye
\input markdown +\def\markdownRendererThematicBreak{\vfil\break} +\markdownBegin + + This is the first page. + + *** + + This is the second page.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11096,26 +11108,26 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {\newpage, - thematicBreak = - }, - }\begin{document} -\begin{markdown} - - This is the first page. - - *** - - This is the second page.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {\newpage, + thematicBreak = + }, + }\begin{document} +\begin{markdown} + + This is the first page. + + *** + + This is the second page.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11127,21 +11139,21 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererThematicBreak{\page[yes]} -\starttext -\startmarkdown - - This is the first page. - - *** - - This is the second page.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererThematicBreak{\page[yes]} +\starttext +\startmarkdown + + This is the first page. + + *** + + This is the second page.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11163,24 +11175,24 @@ respectively. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[taskLists]{markdown} -\markdownSetup{ - - renderers = { - untickedBox = No, - tickedBox = Yes, - }, - }\begin{document} -\begin{markdown} - - - [ ] you can't. - - [x] I can!\end{markdown} -\end{document}
\documentclass{article} +\usepackage[taskLists]{markdown} +\markdownSetup{ + + renderers = { + untickedBox = No, + tickedBox = Yes, + }, + }\begin{document} +\begin{markdown} + + - [ ] you can't. + - [x] I can!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11193,20 +11205,20 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[taskLists = yes] -\def\markdownRendererUntickedBox{No} -\def\markdownRendererTickedBox{Yes} -\starttext -\startmarkdown - - - [ ] you can't. - - [x] I can!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[taskLists = yes] +\def\markdownRendererUntickedBox{No} +\def\markdownRendererTickedBox{Yes} +\starttext +\startmarkdown + + - [ ] you can't. + - [x] I can!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11278,23 +11290,23 @@ rules. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionJekyllData{true} -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \markdownBegin - - --- - name: Jane Doe - age: 99 - ---\markdownEnd -\bye
\input markdown +\def\markdownOptionJekyllData{true} +\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} +\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \markdownBegin + + --- + name: Jane Doe + age: 99 + ---\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11304,29 +11316,29 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - renderers = {\gdef\name{#2}}, - jekyllDataString = {\gdef\age{#2}}, - jekyllDataNumber = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + renderers = {\gdef\name{#2}}, + jekyllDataString = {\gdef\age{#2}}, + jekyllDataNumber = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\begin{document} + +\begin{markdown} + + --- + name: Jane Doe + age: 99 + ---\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11336,26 +11348,26 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[jekyllData = yes] -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \starttext - -\startmarkdown - - --- - name: Jane Doe - age: 99 - ---\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[jekyllData = yes] +\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} +\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \starttext + +\startmarkdown + + --- + name: Jane Doe + age: 99 + ---\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11371,25 +11383,25 @@ class="tex">TeX macros, further referred to as class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererTildePrototype{% -% - Packages can specify token renderer prototypes. - }\markdownBegin - - ~\markdownEnd - -\def\markdownRendererTilde{% -% - User-defined token renderers take precedence. - }\markdownBegin - - ~\markdownEnd -\bye
\input markdown +\def\markdownRendererTildePrototype{% +% + Packages can specify token renderer prototypes. + }\markdownBegin + + ~\markdownEnd + +\def\markdownRendererTilde{% +% + User-defined token renderers take precedence. + }\markdownBegin + + ~\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11400,30 +11412,30 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - rendererPrototypes = { - tilde = {Packages can specify token renderer prototypes.}, - }, - }\begin{document} -\begin{markdown} - - ~\end{markdown} - -\begin{markdown*}{ - - renderers = { - tilde = {User-defined token renderers take precedence.}, - }, - } - ~\end{markdown*} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + rendererPrototypes = { + tilde = {Packages can specify token renderer prototypes.}, + }, + }\begin{document} +\begin{markdown} + + ~\end{markdown} + +\begin{markdown*}{ + + renderers = { + tilde = {User-defined token renderers take precedence.}, + }, + } + ~\end{markdown*} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11434,26 +11446,26 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererTildePrototype{% -% - Packages can specify token renderer prototypes. - }\starttext -\startmarkdown - - ~\stopmarkdown - -\def\markdownRendererTilde{% -% - User-defined token renderers take precedence. - }\startmarkdown - - ~\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererTildePrototype{% +% + Packages can specify token renderer prototypes. + }\starttext +\startmarkdown + + ~\stopmarkdown + +\def\markdownRendererTilde{% +% + User-defined token renderers take precedence. + }\startmarkdown + + ~\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11471,29 +11483,29 @@ the LaTeX3 kernel. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionJekyllData{true} -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \markdownBegin - - --- - name: Jane Doe - age: 99 - ---\markdownEnd -\bye
\input markdown +\def\markdownOptionJekyllData{true} +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \markdownBegin + + --- + name: Jane Doe + age: 99 + ---\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11503,31 +11515,31 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - jekyllDataRenderers = {\gdef\name{#1}}, - name = {\gdef\age{#1}}, - code = { - }, - renderers = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + jekyllDataRenderers = {\gdef\name{#1}}, + name = {\gdef\age{#1}}, + code = { + }, + renderers = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\begin{document} + +\begin{markdown} + + --- + name: Jane Doe + age: 99 + ---\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11537,32 +11549,32 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
+document.tex
with the following content:+\usemodule[t][markdown] +\setupmarkdown[jekyllData = yes] +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \starttext + +\startmarkdown + + --- + name: Jane Doe + age: 99 + ---\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-\usemodule[t][markdown] -\setupmarkdown[jekyllData = yes] -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \starttext - -\startmarkdown - - --- - name: Jane Doe - age: 99 - ---\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
-+class="sourceCode sh">context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:diff --git a/macros/generic/markdown/markdown.pdf b/macros/generic/markdown/markdown.pdf index 68b87a0960..4b99308976 100644 Binary files a/macros/generic/markdown/markdown.pdf and b/macros/generic/markdown/markdown.pdf differ diff --git a/macros/latex/contrib/photobook/README.md b/macros/latex/contrib/photobook/README.md index bb1379915d..004a438e86 100644 --- a/macros/latex/contrib/photobook/README.md +++ b/macros/latex/contrib/photobook/README.md @@ -44,6 +44,12 @@ For more info on `make` targets see the: [./Makefile](./Makefile) ## Notes +- The main refetence is inline with the source [photobook.cls](./photobook.cls) + thus it is both human-readable next to the code it documents and is + used to build the `photobook.pdf`. + Extracting the documentation source (`photobook*.tex`) is done + by [make](./Makefile) via [cls2tex.sh](scripts/README.md#cls2texsh) when + building the docs, see them for more info. - There is a bug in default captions not being typeset correctly if too long, a workaround is to place them in a `minipage` like this: ```latex @@ -72,3 +78,4 @@ Copyright (c) 2021-2023, Alex A. Naanou, All rights reserved. + diff --git a/macros/latex/contrib/photobook/photobook.cls b/macros/latex/contrib/photobook/photobook.cls index 09a8d9a8eb..a0188d793b 100644 --- a/macros/latex/contrib/photobook/photobook.cls +++ b/macros/latex/contrib/photobook/photobook.cls @@ -85,7 +85,7 @@ %%% NOTE: \def\@[A-Z]+ macros will be visible to both the %%% code and the generated docs... -\edef\photobook@FILEVERSION{v0.1.20} +\edef\photobook@FILEVERSION{v0.1.21} \edef\photobook@FILEDATE{2023-04-22} @@ -383,9 +383,10 @@ %% %% blockwidth blockwidth %% <---------------> <---------------> -%% <-> coverboardgrow <-> coverboardgrow -%% <-> coverflap . <-> coverflap -%% . . . . . . +%% <-> coverboardgrow. . <-> coverboardgrow +%% <-> coverflap . . . <-> coverflap +%% . . . . . . . . +%% .xx . xx xx . xx. ] fold marks %% +-------------------++---++-------------------+ --- %% | + - - - - - - - - ++ - ++ - - - - - - - - + | --^ coverflap %% | . + - - - - - - - ++ - ++ - - - - - - - + . | --^ coverboardgrow @@ -397,6 +398,7 @@ %% | . + - - - - - - - ++ - ++ - - - - - - - + . | --v coverboardgrow %% | + - - - - - - - - ++ - ++ - - - - - - - - + | --v coverflap %% +-------------------++---++-------------------+ --- +%% xx xx xx xx ] fold marks %% . . %% ^. .^ spinefold %% . . @@ -422,8 +424,9 @@ %% . . . . %% . . blockwidth blockwidth . . %% . . <---------------> <---------------> . . -%% . .<-> coverboardgrow <-> coverboardgrow -%% . . . . . . +%% . .<-> coverboardgrow. . <-> coverboardgrow +%% . . . . . . . . +%% . xx . .x x. . xx . ] fold marks %% +---++-----------------++---++-----------------++---+ --- %% | .. + - - - - - - - ++ - ++ - - - - - - - + .. | --^ coverboardgrow %% | .. . .. .. . .. | ^ @@ -433,6 +436,7 @@ %% | .. . .. .. . .. | v %% | .. + - - - - - - - ++ - ++ - - - - - - - + .. | --v coverboardgrow %% +---++-----------------++---++-----------------++---+ --- +%% xx x x xx ] fold marks %% .. . . .. %% ^ jacketwrap . . ^ jacketwrap %% ^. .^ spinefold @@ -1075,6 +1079,7 @@ % layout: cover... \ifcoverlayout \pagestyle{empty}% + % XXX should spinefolds be panels??? \setsepchar{,}% \readlist*\pagefoldpanels{% \the\coverflap, @@ -1108,12 +1113,12 @@ \the\jacketwrap, \the\dimexpr \coverboardgrow + + \spinefold + \pageblockwidth \relax, - \the\spinefold, \the\spinewidth, - \the\spinefold, \the\dimexpr \coverboardgrow + + \spinefold + \pageblockwidth \relax, \the\jacketwrap, \the\photobook@jacketflapfront@active}% @@ -1130,6 +1135,7 @@ % layout: spread/endpaper... \ifspreadlayout \pagestyle{empty}% + \setsepchar{,}% \readlist*\pagefoldpanels{% \the\pageblockwidth, \the\pageblockwidth}% @@ -1970,6 +1976,7 @@ %% \DescribeEnv{cliptocell} +%% \DescribeEnv{cliptocellbleeds} % %% Clip content to parent cell. %% @@ -2003,42 +2010,56 @@ \newlength\photobook@cliptocell@bottom \setlength\photobook@cliptocell@bottom{0mm}% +%% Set the default bleeds for |cliptocell| environments +%% +%% >> \cliptocellbleeds{ } +%% >> \cliptocellbleeds{ } +%% >> \cliptocellbleeds{ } +%% +%% This will only affect |cliptocell| environments on the same level, +%% without affecting the nested |cliptocell|s. +%% +% XXX should this set the setsepchar back to default??? +% XXX should this be public??? +% ...mainly due to setsepchar... +\newcommand\cliptocellbleeds[1]{ + \setsepchar{ }% + \readlist*\photobook@cliptocell@bleeds{#1}% + \setsepchar{,}% + % args: size + \ifnum \photobook@cliptocell@bleedslen = 1% + \setlength\photobook@cliptocell@left{% + \photobook@cliptocell@bleeds[1]}% + \setlength\photobook@cliptocell@bottom{% + \photobook@cliptocell@bleeds[1]}% + \setlength\photobook@cliptocell@right{% + \photobook@cliptocell@bleeds[1]}% + \setlength\photobook@cliptocell@top{% + \photobook@cliptocell@bleeds[1]}\fi% + % args: horizontal vertical + \ifnum \photobook@cliptocell@bleedslen = 2% + \setlength\photobook@cliptocell@left{% + \photobook@cliptocell@bleeds[1]}% + \setlength\photobook@cliptocell@bottom{% + \photobook@cliptocell@bleeds[2]}% + \setlength\photobook@cliptocell@right{% + \photobook@cliptocell@bleeds[1]}% + \setlength\photobook@cliptocell@top{% + \photobook@cliptocell@bleeds[2]}\fi% + % args: left bottom right top + \ifnum \photobook@cliptocell@bleedslen = 4% + \setlength\photobook@cliptocell@left{% + \photobook@cliptocell@bleeds[1]}% + \setlength\photobook@cliptocell@bottom{% + \photobook@cliptocell@bleeds[2]}% + \setlength\photobook@cliptocell@right{% + \photobook@cliptocell@bleeds[3]}% + \setlength\photobook@cliptocell@top{% + \photobook@cliptocell@bleeds[4]}\fi} + \newenvironment{cliptocell}[1][0mm]{% \begingroup% - \setsepchar{ }% - \readlist*\photobook@cliptocell@bleeds{#1}% - % - % args: size - \ifnum \photobook@cliptocell@bleedslen = 1% - \setlength\photobook@cliptocell@left{% - \photobook@cliptocell@bleeds[1]}% - \setlength\photobook@cliptocell@bottom{% - \photobook@cliptocell@bleeds[1]}% - \setlength\photobook@cliptocell@right{% - \photobook@cliptocell@bleeds[1]}% - \setlength\photobook@cliptocell@top{% - \photobook@cliptocell@bleeds[1]}\fi% - % args: horizontal vertical - \ifnum \photobook@cliptocell@bleedslen = 2% - \setlength\photobook@cliptocell@left{% - \photobook@cliptocell@bleeds[1]}% - \setlength\photobook@cliptocell@bottom{% - \photobook@cliptocell@bleeds[2]}% - \setlength\photobook@cliptocell@right{% - \photobook@cliptocell@bleeds[1]}% - \setlength\photobook@cliptocell@top{% - \photobook@cliptocell@bleeds[2]}\fi% - % args: left bottom right top - \ifnum \photobook@cliptocell@bleedslen = 4% - \setlength\photobook@cliptocell@left{% - \photobook@cliptocell@bleeds[1]}% - \setlength\photobook@cliptocell@bottom{% - \photobook@cliptocell@bleeds[2]}% - \setlength\photobook@cliptocell@right{% - \photobook@cliptocell@bleeds[3]}% - \setlength\photobook@cliptocell@top{% - \photobook@cliptocell@bleeds[4]}\fi% - % + \cliptocellbleeds{#1} % NOTE: the spaces at the end of each line here are significant!! \begin{trimbox}{{\photobook@cliptocell@left} % {\photobook@cliptocell@bottom} % @@ -2049,10 +2070,7 @@ {\cellwidth + \photobook@cliptocell@right} % {\height + \photobook@cliptocell@top}}% % set defaults for nested cells... - \setlength\photobook@cliptocell@left{0mm}% - \setlength\photobook@cliptocell@top{0mm}% - \setlength\photobook@cliptocell@right{0mm}% - \setlength\photobook@cliptocell@bottom{0mm}% + \cliptocellbleeds{0mm}% \begin{minipage}[t][\cellheight][t]{\cellwidth}% \ignorespaces% }{% @@ -3558,6 +3576,7 @@ \begingroup% \setsepchar{ }% \readlist*\photobook@foldout@args{#1}% + \setsepchar{,}% % % defaults... \setcounter{photobook@foldoutpanel}{1} @@ -3696,6 +3715,7 @@ % parse args... \setsepchar{-}% \readlist*\photobook@foldoutcell@panels{#1}% + \setsepchar{,}% % % auto advance panel... \ifnum \photobook@foldoutcell@panels[1] = 0% diff --git a/macros/latex/contrib/photobook/photobook.pdf b/macros/latex/contrib/photobook/photobook.pdf index f5969aa38f..9368564c5d 100644 Binary files a/macros/latex/contrib/photobook/photobook.pdf and b/macros/latex/contrib/photobook/photobook.pdf differ diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf index 3eb3746590..bb928c6bfb 100644 Binary files a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf and b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf differ diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex index f834c4545c..02c32d66f9 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex @@ -5,8 +5,8 @@ % arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') \documentclass[a4paper,french,11pt]{article} -\def\PLversion{2.6.0} -\def\PLdate{13 Avril 2023} +\def\PLversion{2.6.1} +\def\PLdate{27 avril 2023} \usepackage{ProfLycee} \useproflyclib{piton,minted,pythontex} \usepackage[math-style=french]{fourier-otf} @@ -17,6 +17,7 @@ \usetikzlibrary{hobby} \usepackage[group-minimum-digits=4]{siunitx} \sisetup{locale=FR} +\usepackage{enumitem} \usepackage{fancyvrb} \usepackage{fancyhdr} \usepackage{tabularray} @@ -116,8 +117,8 @@ } } -\NewTCBListing{PresentationCodePL}{ O{blue} m }{% - enhanced,width=0.93\linewidth,flush right,boxrule=0.75pt,colframe=#1!75!Black,% +\NewTCBListing{PresCodeTexPL}{ O{CadetBlue} m }{% + enhanced,width=0.93\linewidth,flush right,boxrule=0.75pt,colframe=#1!85!Black,% sharp corners,top=0mm,bottom=0mm,left=0.4em,right=5mm,% before skip=\baselineskip,after skip=\baselineskip,% colback=white, @@ -129,7 +130,43 @@ listing engine=minted,minted style=colorful,minted language=tex, minted options={tabsize=4,fontsize=\footnotesize,autogobble,breaklines=true}, #2,% - overlay={\draw[#1!75!black] ($(frame.north west)+(-0.035\linewidth,-0.025\linewidth)$) node[scale=1.66] {\faCogs} ;} + overlay={\draw[#1!85!black] ($(frame.north west)+(-0.035\linewidth,-0.025\linewidth)$) node[scale=1.66] {\faCode} ;} +} + +\NewTCBListing{PresCodePL}{ O{CadetBlue} m }{% + enhanced,width=0.93\linewidth,flush right,boxrule=0.75pt,colframe=#1!85!Black,% + sharp corners,top=0mm,bottom=0mm,left=0.4em,right=5mm,% + before skip=\baselineskip,after skip=\baselineskip,% + colback=white, + fontupper=\footnotesize,fontlower=\footnotesize,% + watermark text={\faCogs},watermark opacity=0.25,watermark zoom=0.50,% + title={{\scriptsize\faCogs} Code \LaTeX{} et sortie \LaTeX}, + lefttitle=0.4em, + fonttitle=\bfseries\footnotesize\sffamily,colbacktitle=darkgray!50!#1,% + listing engine=minted,minted style=colorful,minted language=tex, + minted options={tabsize=4,fontsize=\footnotesize,autogobble,breaklines=true}, + #2,% + overlay={% + \draw[#1!85!black] ($(frame.north west)+(-0.035\linewidth,-0.025\linewidth)$) node[scale=1.66] {\faCode} ; + \draw[#1!85!black] ($(segmentation.west)+(-0.035\linewidth,-0.025\linewidth)$) node[scale=1.66] {\faFilePdf} ; + + } +} + +\NewTCBListing{PresCodeSortiePL}{ O{CadetBlue} m }{% + enhanced,width=0.93\linewidth,flush right,boxrule=0.75pt,colframe=#1!85!Black,% + sharp corners,top=0mm,bottom=0mm,left=0.4em,right=5mm,% + before skip=\baselineskip,after skip=\baselineskip,% + colback=white, + fontupper=\footnotesize,fontlower=\footnotesize,% + watermark text={\faFilePdf},watermark opacity=0.25,watermark zoom=0.50,% + title={{\scriptsize\faFilePdf} Sortie \LaTeX}, + lefttitle=0.4em, + fonttitle=\bfseries\footnotesize\sffamily,colbacktitle=darkgray!50!#1,% + listing engine=minted,minted style=colorful,minted language=tex, + minted options={tabsize=4,fontsize=\footnotesize,autogobble,breaklines=true}, + #2,% + overlay={\draw[#1!85!black] ($(frame.north west)+(-0.035\linewidth,-0.025\linewidth)$) node[scale=1.66] {\faFilePdf} ;} } \newtcblisting{codetex}[1][]{% @@ -293,7 +330,7 @@ ~ -\hfill{}\textsl{Merci à Anne pour ses retours et sa relecture !} +\hfill{}\textsl{Merci à Anne et quark67 pour ses retours et sa relecture !} \hfill{}\textsl{Merci à Christophe et Denis pour leurs retours et éclairages !} @@ -372,22 +409,22 @@ J'ai utilisé les {packages} de C. Tellechea, je vous conseille d'aller jeter un \subsection{Chargement du package} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %exemple de chargement pour une compilation en (pdf)latex \documentclass{article} \usepackage{ProfLycee} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} ... -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %exemple de chargement pour une compilation en (xe/lua)latex \documentclass{article} \usepackage{ProfLycee} \usepackage{fontspec} ... -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Librairies, option du package}\label{librairies} @@ -395,10 +432,10 @@ J'ai utilisé les {packages} de C. Tellechea, je vous conseille d'aller jeter un \cmaj{2.5.0} Le package fonctionne désormais avec un système de \clib{librairies}, qui utilisent et chargent des packages spécifiques, avec des compilations particulières, donc l'utilisateur utilisera un système de chargement similaire à celui de \textsf{tcolorbox} ou \textsf{tikz}, dans le préambule, et une fois le package appelé. \end{warningblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \usepackage{ProfLycee} \useproflyclib{...,...} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{noteblock} Les librairies disponibles seront indiquées dans les sections spécifiques. Pour le moment, il existe : @@ -425,12 +462,12 @@ Avec l'option \Cle{build}, l'utilisateur a la possibilité de placer les fichier Dans ce cas il faut créer au préalable le répertoire \menu{build} avant de compiler un fichier, pour éviter toute erreur ! \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} ... \usepackage[build]{ProfLycee} \useproflyclib{...} ... -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{noteblock} L'option \Cle{build} charge certains packages (librairies \clib{minted} et \clib{pythontex}) avec les options : @@ -542,7 +579,7 @@ En dehors de cela, ce sont des tests multiples et variés qui permettront de dé Elles sont présentées de manière \textit{succincte}, mais elles sont présentées de manière \textit{détaillée} dans la suite de la documentation. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %Résolution approchée d'une équation f(x)=k \ResolutionApprochee[clés]{équation}[macro] @@ -555,13 +592,17 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent %Mise en forme de la conclusion d'un seuil \SolutionSeuil[options]{fonction associée}{seuil} -\end{PresentationCodePL} -\begin{PresentationCodePL}{listing only} +%Valeur approchée d'une intégrale +\IntegraleApprochee[clés]{fonction}{a}{b} +\end{PresCodeTexPL} + +\begin{PresCodeTexPL}{listing only} %fenêtre de repérage en tikz et courbe \GrilleTikz[options][options grille ppale][options grille second.] \AxesTikz[options] \AxexTikz[options]{valeurs} \AxeyTikz[options]{valeurs} \FenetreSimpleTikz[options](opt axes) {liste valx} {liste valy} +\DeclareFonctionTikz[nom]{expr} \CourbeTikz[options]{fonction}{valxmin:valxmax} %courbe d'interpolation, tangente, dans un environnement tikz @@ -571,9 +612,12 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent %schémas pour le signe affine/trinôme, dans un environnement tikz \MiniSchemaSignes(*)[clés] \MiniSchemaSignesTkzTab[options]{numligne}[échelle][décalage horizontal] -\end{PresentationCodePL} -\begin{PresentationCodePL}{listing only} +%intégrales et méthodes graphiques +\IntegraleApprocheeTikz[clés]{nom_fonction}{a}{b} +\end{PresCodeTexPL} + +\begin{PresCodeTexPL}{listing only} %présentation de code Python \begin{CodePythonLst}(*)[largeur]{commandes tcbox}...\end{CodePythonLst} \begin{CodePythonLstAlt}(*)[largeur]{commandes tcbox}...\end{CodePythonLstAlt} @@ -591,11 +635,11 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent %présentation de pseudocode \begin{PseudoCode}(*)[largeur]{commandes tcbox}...\end{PseudoCode} \begin{PseudoCodeAlt}(*)[largeur]{commandes tcbox}...\end{PseudoCodeAlt} -\end{PresentationCodePL} +\end{PresCodeTexPL} \pagebreak -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %terminal OS \begin{TerminalWin}[largeur]{clés}[options]...\end{TerminalWin} \begin{TerminalUnix}[largeur]{clés}[options]...\end{TerminalUnix} @@ -603,18 +647,18 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent %code Capytale \CartoucheCapytale(*)[options]{code capytale} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %pavé et tétraèdre, dans un environnement tikz \PaveTikz[options] \TetraedreTikz[options] %cercle trigo, dans un environnement tikz \CercleTrigo[clés] -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %paramètres d'une régression linéaire, nuage de points \CalculsRegLin[clés]{listeX}{listeY} \PointsRegLin[clés]{listeX}{listeY} @@ -632,9 +676,9 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent %boîte à moustaches, dans un environnement tikz \BoiteMoustaches[options] \BoiteMoustachesAxe[options] -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %loi binomiale B(n,p) \CalcBinomP{n}{p}{k} \CalcBinomC{n}{p}{a}{b} @@ -646,9 +690,9 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent \CalcPoissC{l}{a}{b} \PoissonP(*)[prec]{l}{k} \PoissonC(*)[prec]{l}{a}{b} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %loi géométrique G(p) \CalcGeomP{p}{k} \CalcGeomC{l}{a}{b} @@ -660,9 +704,9 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent \CalcHypergeomP{N}{n}{m}{a}{b} \HypergeomP{N}{n}{m}{k} \HypergeomC{N}{n}{m}{a}{b} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %loi normale N(m,s) \CalcNormC{m}{s}{a}{b} \NormaleC(*)[prec]{m}{s}{a}{b} @@ -678,9 +722,9 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent %schémas lois continues \LoiNormaleGraphe[options] {m}{s}{a}{b} \LoiExpoGraphe[options] {l}{a}{b} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %entier aléatoire entre a et b \NbAlea{a}{b}{macro} %nombre décimal (n chiffres après la virgule) aléatoire entre a et b+1 (exclus) @@ -689,17 +733,17 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent \VarNbAlea{macro}{calcul} %liste d'entiers aléatoires \TirageAleatoireEntiers[options]{macro} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %arrangement Anp \Arrangement(*)[option]{p}{n} %arrangement Cnp (p parmi n) \Combinaison(*)[option]{p}{n} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %conversions \ConversionDecBin(*)[clés]{nombre} \ConversionBinHex[clés]{nombre} @@ -709,9 +753,9 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent %PGCD présenté \PresentationPGCD[options]{a}{b} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %conversion en fraction, simplification de racine \ConversionFraction(*)[option]{argument} \SimplificationRacine{expression} @@ -725,13 +769,13 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent %mesure principale, lignes trigo \MesurePrincipale[options]{angle} \LigneTrigo(*)[booléens]{cos/sin/tan}(angle) -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %sudomaths \SudoMaths[options]{liste} \begin{EnvSudoMaths}[options]{grille}...\end{EnvSudoMaths} -\end{PresentationCodePL} +\end{PresCodeTexPL} \newpage @@ -759,18 +803,18 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent La méthode utilisée est la \textbf{dichotomie}, pour plus de rapidité que la méthode \textit{simple} par balayage. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \ResolutionApprochee[clés]{équation}[macro] -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \ResolutionApprochee[Intervalle=0:10]{x**3-2*x**2-x-1=2}% $x_0 \approx \num[minimum-decimal-digits=2]{\masolutiond}$ par défaut ;\\ $x_0 \approx \num[minimum-decimal-digits=2]{\masolutione}$ par excès ;\\ $x_0 \approx \num[minimum-decimal-digits=2]{\masolutiona}$ arrondi à $10^{-2}$.\\ \hfill\includegraphics[scale=0.45]{./graphics/pl-solve_a}\hfill~ -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Clés et options} @@ -794,7 +838,7 @@ Quelques explications sur les \Cle{clés} et sur les arguments : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \ResolutionApprochee[Precision=4,Intervalle=0:2]{exp(0.5*x)+x**2-4=0}% Une valeur approchée, à $10^{-4}$ près, d'une solution de $\text{e}^{0,5x}+x^2-4=0$ sur $\left[0;2\right]$ est $\beta$ avec : \begin{itemize} @@ -822,7 +866,7 @@ Une valeur approchée, à $10^{-2}$ près d'une solution de $3t\,\text{e}^{-0,5t \hfill\includegraphics[scale=0.45]{./graphics/pl-solve_b}~~ \includegraphics[scale=0.45]{./graphics/pl-solve_c}~~ \includegraphics[scale=0.45]{./graphics/pl-solve_d}\hfill~ -\end{PresentationCodePL} +\end{PresCodePL} \newpage @@ -838,9 +882,9 @@ Une valeur approchée, à $10^{-2}$ près d'une solution de $3t\,\text{e}^{-0,5t Le code ne trouve pas la solution, il met \textit{juste} en forme mais effectue quand même les calculs d'images et les tests. \end{warningblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \SolutionTVI[options]{fonction}{valeur} -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Clés et arguments} @@ -863,21 +907,21 @@ Plusieurs \Cle{Clés} sont disponibles pour cette commande, relative à une équ Le premier argument \textit{obligatoire} est la fonction, en syntaxe \ctex{xint} et avec comme variable $x$, et le second la valeur de $k$. \end{cautionblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} Pour $f(x)=0$ avec $f(x)=x^2-2$. On obtient \SolutionTVI[va=1.414,vb=1.415,Precision=3]{x**2-2}{0}. -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} Avec $\varphi(t)=3t\,\rm{e}^{-0,5t+1}=5$, \SolutionTVI[Majuscule=false,Calculatrice,va=1.02,vb=1.03,NomFct=\varphi] {3*x*exp(-0.5*x+1)}{5} -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} On s'intéresse à $g(x)=\num{1,5}$ avec $g(x)=\ln(x)$.\\ \SolutionTVI% [Balayage,Stretch=1.5,va=4.48,vb=4.49,NomFct=g,Precision=4,NomSol={x_0}]{log(x)}{1.5}. -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Interaction avec la commande de résolution approchée} @@ -885,14 +929,14 @@ On s'intéresse à $g(x)=\num{1,5}$ avec $g(x)=\ln(x)$.\\ \cmaj{2.1.4} L'idée est de récupérer les valeurs par défaut et par excès pour le TVI grâce à la commande \ctex{\textbackslash ResolutionApprochee}. \end{tipblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} On s'intéresse à $g(x)=\num{1,5}$ avec $g(x)=\ln(x)$ sur l'intervalle $\left[3;5\right]$. \ResolutionApprochee[Intervalle=3:5]{log(x)=1.5}[SolLn] \SolutionTVI% [Balayage,Stretch=1.5,va={\SolLnd},vb={\SolLne}, NomFct=g,Precision=4,NomSol={x_0}]{log(x)}{1.5}. -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} À terme, peut-être que la commande \ctex{\textbackslash ResolutionApprochee} sera intégrée dans la commande \ctex{\textbackslash SolutionTVI} afin d'automatiser encore plus le procédé. @@ -922,13 +966,13 @@ On s'intéresse à $g(x)=\num{1,5}$ avec $g(x)=\ln(x)$ sur l'intervalle $\left[3 \cmaj{2.0.5} Le choix a été fait de faire les calculs en mode \ctex{float} pour éviter les dépassements de capacité de \ctex{xint} liés aux boucles\ldots \end{warningblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %commande pour calculer et formater \CalculTermeRecurrence[options]{fonction associée} %mise en forme de la conclusion d'un seuil \SolutionSeuil[options]{fonction associée}{seuil} -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Clés et arguments} @@ -947,7 +991,7 @@ Plusieurs \Cle{Clés} sont disponibles pour la commande du calcul d'un terme : L'argument \textit{obligatoire} est la fonction associée à la suite, en syntaxe \ctex{xint} et avec comme variable $x$. \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} Avec $\begin{dcases} u_0 = 50 \\ u_{n+1}=\dfrac{1}{u_n+2} \end{dcases}$. On obtient $u_{10} \approx \CalculTermeRecurrence[No=0,UNo=50,N=10]{1/(x+2)}$. @@ -955,9 +999,9 @@ On obtient $u_{10} \approx \CalculTermeRecurrence[No=0,UNo=50,N=10]{1/(x+2)}$. On obtient $u_{15} \approx \CalculTermeRecurrence[Precision=4,No=0,UNo=50,N=15]{1/(x+2)}$. On obtient $u_{20} \approx \CalculTermeRecurrence[Precision=6,No=0,UNo=50,N=20]{1/(x+2)}$. -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} Avec $u_0 = 50$ et $u_{n+1}=\dfrac{1}{u_n+2}$. \smallskip @@ -971,7 +1015,7 @@ On obtient $u_{15} \approx \CalculTermeRecurrence[Precision=4,No=0,UNo=50,N=15]{ \smallskip On obtient $u_{20} \approx \CalculTermeRecurrence[Precision=6,No=0,UNo=50,N=20]{1/(x+2)}$ \hfill~avec choix de la précision à $10^{-6}$. -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{cautionblock} Plusieurs \Cle{Clés} sont disponibles pour la commande du seuil : @@ -996,18 +1040,16 @@ Plusieurs \Cle{Clés} sont disponibles pour la commande du seuil : Le premier argument \textit{obligatoire} est la fonction associée à la suite, en syntaxe \ctex{xint} et avec comme variable $x$, et le second est le seuil à dépasser. \end{cautionblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} Avec $\begin{dcases} u_1 = 2 \\ u_{n+1}=1+\dfrac{1+u_n^2}{1+u_n} \end{dcases}$, on cherche $n$ tel que $u_n > 5$.\\ -\SolutionSeuil[Balayage,No=1,UNo=2]{1+(1+x**2)/(1+x)}{5}. - -\SolutionSeuil[Calculatrice,Precision=4,No=1,UNo=2,Conclusion=false]% +\SolutionSeuil[Balayage,No=1,UNo=2]{1+(1+x**2)/(1+x)}{5}. \SolutionSeuil[Calculatrice,Precision=4,No=1,UNo=2,Conclusion=false]% {1+(1+x**2)/(1+x)}{5}. -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Exemple d'utilisation} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} Avec $\begin{dcases} u_1 = 2 \\ u_{n+1}=1+\dfrac{1+u_n^2}{1+u_n} \end{dcases}$, on obtient le tableau de valeurs suivant : \begin{tabular}{c|c} @@ -1017,7 +1059,121 @@ on obtient le tableau de valeurs suivant : \end{tabular}\\ \SolutionSeuil[Precision=4,No=1,UNo=2,Simple]{1+(1+x**2)/(1+x)}{10} (Ainsi $u_n > 10$ à partir de $n=\the\CompteurSeuil$) -\end{PresentationCodePL} +\end{PresCodePL} + +\newpage + +\section{Valeur approchée d'une intégrale}\label{calcintegr} + +\subsection{Idée} + +\begin{tipblock} +\cmaj{2.6.1} L'idée est de proposer plusieurs approximations pour le calcul d'une intégrale, en utilisant : +\begin{itemize} + \item une méthode des rectangles (Gauche, Droite ou Milieu) ; + \item la méthode des trapèzes ; + \item la méthode de Simpson. +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{warningblock} +Il s'agit de valeurs approchées, mais la méthode de Simpson donne des valeurs satisfaisantes ! + +Les méthodes \textit{Rectangles} ou \textit{Trapèzes} seront plutôt utiles pour des résultats obtenus par algorithme par exemple. +\end{warningblock} + +\begin{PresCodeTexPL}{listing only} +\IntegraleApprochee[clés]{fonction}{a}{b} +\end{PresCodeTexPL} + +\subsection{Clés et arguments} + +\begin{cautionblock} +Plusieurs \Cle{Clés} sont disponibles pour la commande de calcul : + +\begin{itemize} + \item le booléen \Cle{ResultatBrut} qui donne le résultat obtenu grâce à \ctex{xint} ; \hfill~défaut : \Cle{false} + \item la clé \Cle{Methode}, parmi \Cle{RectanglesGauche / RectanglesDroite / RectanglesMilieu / Trapezes / Simpson} pour spécifier la méthode utilisée ; + + \hfill~défaut : \Cle{Simpson} + \item la clé \Cle{NbSubDiv} précise le nombre de subdivisions pour le calcul ; \hfill~défaut : \Cle{10} + \item le booléen \Cle{AffFormule} qui affiche au préalable l'intégrale ;\hfill{}défaut \Cle{false} + \item la clé \Cle{Expr} qui indique ce qui doit être affiché dans l'intégrale ; \hfill{}défaut \Cle{f(x)} + \item la clé \Cle{Signe} qui indique le signe à afficher entre l'intégrale et le résultat ; \hfill{}défaut \Cle{\textbackslash approx} + \item la clé \Cle{Variables} qui indique la variable à afficher dans le $\text{d}x$. \hfill{}défaut \Cle{x} +\end{itemize} + +\smallskip + +Concernant les arguments obligatoires : + +\begin{itemize} + \item le premier est la fonction à intégrer, en langage \ctex{xint}, avec comme variable $x$ ; + \item les deux autres arguments sont les bornes de l'intégrale. +\end{itemize} + +À noter que la commande, hormis dans sa version \Cle{ResultatBrut}, est à insérer de préférence dans un mode mathématique. +\end{cautionblock} + +\begin{PresCodePL}{} +On s'intéresse à $\displaystyle\int_4^{10} f(x) \,\text{d}x$ avec $f(x)=\sqrt{x}$ :\\ +\begin{itemize}[itemsep=6pt,leftmargin=4cm] + \item[\texttt{sortie par défaut} :] \IntegraleApprochee{sqrt(x)}{4}{10} + \item[\texttt{résultat brut} :] \IntegraleApprochee[ResultatBrut]{sqrt(x)}{4}{10} + \item[\texttt{résultat formaté} :] $\displaystyle\IntegraleApprochee[NbSubDiv=100,AffFormule,Precision=5,Expr={\sqrt{x}}]% + {sqrt(x)}{4}{10}$ +\end{itemize} +\end{PresCodePL} + +\subsection{Exemples} + +\begin{PresCodeTexPL}{listing only} +%tableau +\IntegraleApprochee[NbSubDiv=10,ResultatBrut]{sqrt(x)}{4}{10} +\IntegraleApprochee[NbSubDiv=10,Methode=RectanglesGauche,ResultatBrut]{sqrt(x)}{4}{10} +\IntegraleApprochee[NbSubDiv=10,Methode=RectanglesDroite,ResultatBrut]{sqrt(x)}{4}{10} +\IntegraleApprochee[NbSubDiv=10,Methode=RectanglesMilieu,ResultatBrut]{sqrt(x)}{4}{10} +\IntegraleApprochee[NbSubDiv=10,Methode=Trapezes,ResultatBrut]{sqrt(x)}{4}{10} +$\displaystyle\IntegraleApprochee[NbSubDiv=10,AffFormule,Expr={\sqrt{x}}]{sqrt(x)}{4}{10}$ +\end{PresCodeTexPL} + +\begin{PresCodeSortiePL}{text only} +\begin{tblr}[B]{hlines,vlines,colspec={Q[5cm,m,l]Q[5cm,m,l]},row{1}={halign=c,font=\bfseries\sffamily,bg=lightgray}} + Méthode utilisée & Valeur brute obtenue \\ + \SetCell[c=2]{c} $f(x)=\sqrt{x}$ et $n=10$ ; $\displaystyle\int_4^{10} f(x) \,\text{d}x$ & \\ + Simpson & $\IntegraleApprochee[NbSubDiv=10,Methode=Simpson,ResultatBrut]{sqrt(x)}{4}{10}$ \\ + rectangles Gauche & $\IntegraleApprochee[NbSubDiv=10,Methode=RectanglesGauche,ResultatBrut]{sqrt(x)}{4}{10}$ \\ + rectangles Droite & $\IntegraleApprochee[NbSubDiv=10,Methode=RectanglesDroite,ResultatBrut]{sqrt(x)}{4}{10}$ \\ + rectangles Milieu & $\IntegraleApprochee[NbSubDiv=10,Methode=RectanglesMilieu,ResultatBrut]{sqrt(x)}{4}{10}$ \\ + trapèzes & $\IntegraleApprochee[NbSubDiv=10,Methode=Trapezes,ResultatBrut]{sqrt(x)}{4}{10}$ \\ + \SetCell[c=2]{c} $\displaystyle\IntegraleApprochee[NbSubDiv=10,AffFormule,Expr={\sqrt{x}}]{sqrt(x)}{4}{10}$ & \\ +\end{tblr}~~\includegraphics[height=3cm]{integr_nwks_a} +\end{PresCodeSortiePL} + +\begin{PresCodeTexPL}{listing only} +%tableau +\IntegraleApprochee[NbSubDiv=100,Methode=Simpson,ResultatBrut]{80*x*exp(-0.2*x)}{1}{20} +\IntegraleApprochee[NbSubDiv=100,Methode=RectanglesGauche,ResultatBrut]{80*x*exp(-0.2*x)}{1}{20} +\IntegraleApprochee[NbSubDiv=100,Methode=RectanglesDroite,ResultatBrut]{80*x*exp(-0.2*x)}{1}{20} +\IntegraleApprochee[NbSubDiv=100,Methode=RectanglesMilieu,ResultatBrut]{80*x*exp(-0.2*x)}{1}{20} +\IntegraleApprochee[NbSubDiv=100,Methode=Trapezes,ResultatBrut]{80*x*exp(-0.2*x)}{1}{20} +$\displaystyle\IntegraleApprochee[NbSubDiv=100,AffFormule,Expr={80x\,\text{e}^{-0,2x}}]% + {80*x*exp(-0.2*x)}{1}{20}$ +\end{PresCodeTexPL} + +\begin{PresCodeSortiePL}{text only} +\begin{tblr}[B]{hlines,vlines,colspec={Q[5cm,m,l]Q[5cm,m,l]},row{1}={halign=c,font=\bfseries\sffamily,bg=lightgray}} + Méthode utilisée & Valeur brute obtenue \\ + \SetCell[c=2]{c} $f(x)=80x\,\text{e}^{-0,2x}$ et $n=100$ ; $\displaystyle\int_1^{20} f(x) \,\text{d}x$ & \\ + Simpson & $\IntegraleApprochee[NbSubDiv=100,Methode=Simpson,ResultatBrut]{80*x*exp(-0.2*x)}{1}{20}$ \\ + rectangles Gauche & $\IntegraleApprochee[NbSubDiv=100,Methode=RectanglesGauche,ResultatBrut]{80*x*exp(-0.2*x)}{1}{20}$ \\ + rectangles Droite & $\IntegraleApprochee[NbSubDiv=100,Methode=RectanglesDroite,ResultatBrut]{80*x*exp(-0.2*x)}{1}{20}$ \\ + rectangles Milieu & $\IntegraleApprochee[NbSubDiv=100,Methode=RectanglesMilieu,ResultatBrut]{80*x*exp(-0.2*x)}{1}{20}$ \\ + trapèzes & $\IntegraleApprochee[NbSubDiv=100,Methode=Trapezes,ResultatBrut]{80*x*exp(-0.2*x)}{1}{20}$ \\ + \SetCell[c=2]{c} $\displaystyle\IntegraleApprochee[NbSubDiv=100,AffFormule,Expr={80x\,\text{e}^{-0,2x}}]{80*x*exp(-0.2*x)}{1}{20}$ & \\ +\end{tblr}~~\includegraphics[height=3cm]{integr_nwks_b} +\end{PresCodeSortiePL} \newpage @@ -1057,7 +1213,7 @@ Au niveau du code, il y aura donc plusieurs \textit{aspects} : \vspace*{-\baselineskip}\leavevmode \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %version basique \begin{tikzpicture}[paramètres] %grille et axes @@ -1068,9 +1224,9 @@ Au niveau du code, il y aura donc plusieurs \textit{aspects} : %courbe \CourbeTikz[options]{fonction}{valxmin:valxmax} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %version simplifiée \begin{tikzpicture}[] %grille et axes @@ -1078,9 +1234,9 @@ Au niveau du code, il y aura donc plusieurs \textit{aspects} : %courbe \CourbeTikz[options]{fonction}{valxmin:valxmax} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{tikzpicture}% [x=0.1cm,y=0.0167cm, %unités xmin=0,xmax=60,xgrille=5,xgrilles=5, %axe Ox @@ -1089,7 +1245,7 @@ Au niveau du code, il y aura donc plusieurs \textit{aspects} : \CourbeTikz[line width=1.25pt,ForestGreen,samples=250]% {\x*\x*exp(-0.05*\x)+1}{0:60} %courbe \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Commandes, clés et options} @@ -1104,17 +1260,17 @@ Les \Cle{paramètres} nécessaires à la bonne utilisation des commandes suivant \item \Cle{xgrilles}, stockée dans \ctex{\textbackslash{}xgrilles}, graduation secondaire.\hfill{}défaut \Cle{0.5} \end{itemize} -La fenêtre d'affichage (de sortie) sera donc \textit{portée} par le rectangle de coins $(\text{xmin}\,;\,\text{ymin})$ et $(\text{xmax}\,;\,\text{ymax})$ ; ce qui correspond en fait à la fenêtre \TikZ{} \textit{portée} par le rectangle de coins $(\text{xmin-Ox}\,;\,\text{ymin-Oy})$ et $(\text{xmax-Ox}\,;\,\text{ymax-Oy})$. +La fenêtre d'affichage (de sortie) sera donc \textit{portée} par le rectangle de coins $(\text{xmin};\text{ymin})$ et $(\text{xmax};\text{ymax})$ ; ce qui correspond en fait à la fenêtre \TikZ{} \textit{portée} par le rectangle de coins $(\text{xmin-Ox};\text{ymin-Oy})$ et $(\text{xmax-Ox};\text{ymax-Oy})$. \smallskip Les commandes ont -- pour certaines -- pas mal de \Cle{clés} pour des réglages fins, mais dans la majorité des cas elles ne sont pas forcément \textit{utiles}. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %...code tikz \GrilleTikz[options][options grille ppale][options grille second.] -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Cette commande permet de tracer une grille principale et/ou une grille secondaire : @@ -1126,7 +1282,7 @@ Cette commande permet de tracer une grille principale et/ou une grille secondair \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture}% [x=0.1cm,y=0.0167cm, %unités xmin=0,xmax=60,xgrille=5,xgrilles=5, %axe Ox @@ -1140,9 +1296,9 @@ Cette commande permet de tracer une grille principale et/ou une grille secondair ymin=0,ymax=240,ygrille=30,ygrilles=30] %axe Oy \GrilleTikz[Affp=false][][orange,densely dotted] \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \hfill~ \begin{tikzpicture}% [x=0.1cm,y=0.0167cm, %unités @@ -1158,14 +1314,14 @@ Cette commande permet de tracer une grille principale et/ou une grille secondair \GrilleTikz[Affp=false][][orange,densely dotted] \end{tikzpicture} \hfill~ -\end{PresentationCodePL} +\end{PresCodeSortiePL} \pagebreak -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %...code tikz \AxesTikz[options] -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Cette commande permet de tracer les axes, avec des \Cle{clés} : @@ -1192,7 +1348,7 @@ Cette commande permet de tracer les axes, avec des \Cle{clés} : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %code tikz \AxesTikz @@ -1201,9 +1357,9 @@ Cette commande permet de tracer les axes, avec des \Cle{clés} : [AffLabel=xy,Labelx={Nombre de jours},Labely={Nombre d'individus infectés, en centaines},% PosLabelx={above left},PosLabely={above right},% Police=\small\sffamily,ElargirOx=0,ElargirOy=0] -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \hfill~ \begin{tikzpicture}% [x=0.1cm,y=0.0167cm, %unités @@ -1224,15 +1380,15 @@ Cette commande permet de tracer les axes, avec des \Cle{clés} : Police=\small\sffamily] \end{tikzpicture} \hfill~ -\end{PresentationCodePL} +\end{PresCodeSortiePL} \pagebreak -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %...code tikz \AxexTikz[options]{valeurs} \AxeyTikz[options]{valeurs} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} identiques pour les deux directions : @@ -1259,7 +1415,7 @@ Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} ide \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %code tikz \AxexTikz[Police=\small]{0,5,...,55} \AxeyTikz[Police=\small]{0,30,...,210} @@ -1267,9 +1423,9 @@ Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} ide \AxexTikz[Police=\small,HautGrad=0pt/4pt]{0,5,...,55} \AxeyTikz[AffGrad=false,HautGrad=6pt]{0,30,...,210} %des axes fictifs (en gris) sont rajoutés pour la lisibilité du code de sortie -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \hfill~ \begin{tikzpicture}% [x=0.1cm,y=0.0167cm, %unités @@ -1291,9 +1447,9 @@ Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} ide \AxeyTikz[AffGrad=false,HautGrad=6pt]{0,30,...,210} \end{tikzpicture} \hfill~ -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture}[x=2cm,y=1cm,xmin=0,xmax={2*pi},xgrille=0.5,xgrilles=0.25, ymin=-1.15,ymax=1.15,ygrille=0.5,ygrilles=0.25] \GrilleTikz \AxesTikz @@ -1301,9 +1457,9 @@ Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} ide {3*pi/4},{5*pi/6},pi,{7*pi/6},{5*pi/4}} \CourbeTikz[thick,blue,samples=250]{cos(deg(\x))}{0:2*pi} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{tikzpicture} [x=2cm,y=1cm,xmin=0,xmax={2*pi},xgrille=0.5,xgrilles=0.25, ymin=-1.15,ymax=1.15,ygrille=0.5,ygrilles=0.25] @@ -1312,16 +1468,16 @@ Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} ide {3*pi/4},{5*pi/6},pi,{7*pi/6},{5*pi/4}} \CourbeTikz[thick,blue,samples=250]{cos(deg(\x))}{0:2*pi} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{noteblock} La clé \Cle{Trigo} utilise, en interne, une commande qui permet de \textit{transformer} les abscisses, données en langage \TikZ, en fraction en \LaTeX. \end{noteblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\AffAngleRadian{0}$ \quad $\AffAngleRadian{pi}$ \quad $\AffAngleRadian{pi/4}$ \quad $\AffAngleRadian{2*pi/3}$ \quad $\AffAngleRadian{-2*pi/3}$ \quad $\AffAngleRadian*{-2*pi/3}$ -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Commandes annexes} @@ -1336,21 +1492,21 @@ Il existe, de manière marginale, quelques commandes complémentaires qui ne ser \vspace*{-\baselineskip}\leavevmode \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %code tikz \FenetreTikz %on restreint les tracés \FenetreSimpleTikz% [options](opt axes) {valeurs Ox} {valeurs Oy} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{tipblock} L'idée est de proposer, en \textit{complément}, une commande simplifiée pour tracer une courbe en \TikZ. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %...code tikz \CourbeTikz[options]{formule}{domaine} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Cette commande permet de rajouter une courbe sur le graphique (sans se soucier de la transformation de son expression) avec les arguments : @@ -1363,7 +1519,7 @@ Cette commande permet de rajouter une courbe sur le graphique (sans se soucier d \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture}[x=0.1cm,y=0.0167cm, %unités xmin=0,xmax=60,xgrille=5,xgrilles=5, %axe Ox ymin=0,ymax=240,ygrille=30,ygrilles=30] %axe Oy @@ -1373,9 +1529,9 @@ Cette commande permet de rajouter une courbe sur le graphique (sans se soucier d \CourbeTikz[line width=1.25pt,ForestGreen,samples=250]% {\x*\x*exp(-0.05*\x)+1}{0:60} %courbe \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{tikzpicture}% [x=0.1cm,y=0.0167cm, %unités xmin=0,xmax=60,xgrille=5,xgrilles=5,ymin=0,ymax=240,ygrille=30,ygrilles=30] @@ -1384,22 +1540,22 @@ Cette commande permet de rajouter une courbe sur le graphique (sans se soucier d \CourbeTikz[line width=1.25pt,ForestGreen,samples=250]% {\x*\x*exp(-0.05*\x)+1}{0:60} %courbe \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Repère non centré en O} \begin{tipblock} -Parfois on est amené à travailler dans des repères qui n'ont pas forcément pour origine $(0\,;\,0)$. De ce fait - pour éviter des erreurs de \ctex{dimension too large} liées à \TikZ{} - il faut \textit{décaler les axes} pour se ramener à une origine en $O$. L'idée est donc d'utiliser les commandes précédentes, sans se soucier des éventuelles transformations ! +Parfois on est amené à travailler dans des repères qui n'ont pas forcément pour origine $(0;0)$. De ce fait - pour éviter des erreurs de \ctex{dimension too large} liées à \TikZ{} - il faut \textit{décaler les axes} pour se ramener à une origine en $O$. L'idée est donc d'utiliser les commandes précédentes, sans se soucier des éventuelles transformations ! \end{tipblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \begin{tikzpicture}[x=0.35cm,y=0.07cm,Ox=1992,xmin=1992,xmax=2010,% xgrille=2,xgrilles=1,Oy=1640,ymin=1640,ymax=1710,ygrille=10,ygrilles=5] \FenetreSimpleTikz {1992,1994,...,2008}{1640,1650,...,1700} \FenetreTikz \CourbeTikz[line width=1.25pt,orange,samples=500]{-(\x-2000)*(\x-2000)+1700}{\xmin:\xmax} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodePL} \pagebreak @@ -1435,13 +1591,13 @@ Pour déclarer les paramètres : \subsection{Code, clés et options} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture} ... \SplineTikz[options]{liste} ... \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Certains paramètres et \Cle{clés} peuvent être gérés directement dans la commande \ctex{splinetikz} : @@ -1481,7 +1637,7 @@ Si jamais il existe (un ou) des points \textit{anguleux}, le plus simple est de \subsection{Exemples} -\begin{PresentationCodePL}{tikz lower} +\begin{PresCodePL}{tikz lower} %code tikz \def\x{0.9cm}\def\y{0.9cm} \def\xmin{-1}\def\xmax{11}\def\xgrille{1}\def\xgrilles{0.5} @@ -1497,7 +1653,7 @@ Si jamais il existe (un ou) des points \textit{anguleux}, le plus simple est de %splines \def\LISTE{0/1/0§4/3.667/-0.333§7.5/1.75/0§9/2/-0.333§10/0/-10} \SplineTikz[AffPoints,Coeffs=3,Couleur=red]{\LISTE} -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} Avec des explications utiles à la compréhension : @@ -1535,15 +1691,15 @@ On peut dans ce cas \textit{jouer} sur les coefficients de cette portion pour \t \end{center} \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} ... %splines \def\LISTE{0/1/0§4/3.667/-0.333§7.5/1.75/0§9/2/-0.333§10/0/-10} \SplineTikz[AffPoints,Coeffs=3§3§3§2/1]{\LISTE} ... -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \begin{tikzpicture}[x=0.9cm,y=0.9cm,xmin=-1,xmax=11,xgrille=1,xgrilles=0.5,ymin=-1,ymax=5,ygrille=1,ygrilles=0.5] %axes et grilles @@ -1559,7 +1715,7 @@ On peut dans ce cas \textit{jouer} sur les coefficients de cette portion pour \t \SplineTikz[AffPoints,Coeffs=3§3§3§2/1]{\LISTE} \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Conclusion} @@ -1588,13 +1744,13 @@ En parallèle de l'outil \ctex{SplineTikz}, il existe l'outil \ctex{TangenteTikz NB : il peut fonctionner indépendamment de l'outil \ctex{SplineTikz} puisque la liste des points de travail est gérée de manière autonome ! \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture} ... \TangenteTikz[options]{liste} ... \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Cela permet de tracer la tangente : @@ -1609,7 +1765,7 @@ Cela permet de tracer la tangente : \subsection{Exemple et illustration} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture} ... \def\LISTE{0/1.5/0§1/2/-0.333§2/0/-5} @@ -1621,9 +1777,9 @@ Cela permet de tracer la tangente : \TangenteTikz[xl=0.33,xr=0,Couleur=blue,Style=densely dashed,Point=3]{\LISTE} ... \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} On obtient le résultat suivant (avec les éléments rajoutés utiles à la compréhension) : \begin{center} @@ -1648,11 +1804,11 @@ On obtient le résultat suivant (avec les éléments rajoutés utiles à la comp \draw[thick,darkgray] (4pt,1)--(-4pt,1) node[left,font=\sffamily] {1} ; \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Exemple avec les deux outils, et \og personnalisation \fg} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \tikzset{% xmin/.store in=\xmin,xmin/.default=-5,xmin=-5, xmax/.store in=\xmax,xmax/.default=5,xmax=5, @@ -1682,9 +1838,9 @@ On obtient le résultat suivant (avec les éléments rajoutés utiles à la comp %la courbe en elle-même \SplineTikz[AffPoints,Coeffs=3,Couleur=cyan,Style=densely dotted]{\liste} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \begin{tikzpicture}[x=0.5cm,y=0.5cm,xmin=0,xmax=16,xgrilles=1,ymin=0,ymax=16,ygrilles=1] \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.3pt,lightgray] (\xmin,\ymin) grid (\xmax,\ymax) ; @@ -1705,7 +1861,7 @@ On obtient le résultat suivant (avec les éléments rajoutés utiles à la comp \SplineTikz[AffPoints,Coeffs=3,Couleur=cyan,Style=densely dotted]{\liste} \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -1727,23 +1883,23 @@ Comme pour les autres commandes \TikZ, l'idée est de laisser la possibilité à \cmaj{2.1.9} Il est à noter que la version \textit{étoilée} rend la commande autonome, sans besoin de créer l'environnement \TikZ. \end{tipblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \MiniSchemaSignes* -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Commandes} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture}[ ] \MiniSchemaSignes[clés] \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} {\tikz[options] \MiniSchemaSignes[clés]} %ou \MiniSchemaSignes*[clés] -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} \cmaj{2.1.9} La version \textit{étoilée} de la commande permet de basculer en mode \textit{autonome}, c'est-à-dire sans avoir besoin de créer son environnement \TikZ. @@ -1778,7 +1934,7 @@ Pour la clé \Cle{code}, il est construit par le type (\textsf{a} pour affine ou \pagebreak -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{center} \MiniSchemaSignes*[Code=da+,Racines=-4] ~~~~ @@ -1800,9 +1956,9 @@ Pour la clé \Cle{code}, il est construit par le type (\textsf{a} pour affine ou ~~~~ \MiniSchemaSignes*[Code=pa-d0,Racines={-1},Couleur=magenta] \end{center} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \MiniSchemaSignes*[Code=da+,Racines=-4] ~~~~ @@ -1824,15 +1980,15 @@ Pour la clé \Cle{code}, il est construit par le type (\textsf{a} pour affine ou ~~~~ \MiniSchemaSignes*[Code=pa-d0,Racines={-1},Couleur=magenta] \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \begin{tikzpicture} \MiniSchemaSignes[Largeur=3.5,Hauteur=1.5,Code=da-,Racines=\tfrac{-b}{a},Couleur=Plum] \end{tikzpicture} \MiniSchemaSignes*[Code=da-,Racines=\tfrac{-b}{a},Couleur=Plum] -\end{PresentationCodePL} +\end{PresCodePL} \pagebreak @@ -1844,12 +2000,12 @@ Ces schémas peuvent être de plus utilisés, via la commande \ctex{MiniSchemaSi Pour des raisons internes, le fonctionnement de la commande \ctex{MiniSchemaSignesTkzTab} est légèrement différent et, pour des raisons que j'ignore, le code est légèrement différent en \textit{interne} (avec une \textit{déconnexion} des caractères \textsf{:} et \textsf{\textbackslash}) pour que la librairie \TikZ{} \ctex{calc} puisse fonctionner (mystère pour le moment\ldots) \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture} %commandes tkztab \MiniSchemaSignesTkzTab[options]{numligne}[echelle][décalage horizontal] \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Les \Cle{Clés} pour le premier argument \textit{optionnel} sont les mêmes que pour la version \textit{initiale} de la commande précédente. @@ -1865,7 +2021,7 @@ En ce qui concerne les autres arguments : À noter que si l'un des arguments optionnels (le n°3 et/ou le n°4) sont utilisés, il vaut mieux préciser les 2 ! \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{center} \begin{tikzpicture} \tkzTabInit[]{$x$/1,$-2x+5$/1,$2x+4$/1,$p(x)$/1}{$-\infty$,$-2$,${2,5}$,$+\infty$} @@ -1878,9 +2034,9 @@ En ce qui concerne les autres arguments : {3}[0.85][2] \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \begin{tikzpicture} \tkzTabInit[]{$x$/1,$-2x+5$/1,$2x+4$/1,$p(x)$/1}{$-\infty$,$-2$,${2,5}$,$+\infty$} @@ -1892,7 +2048,7 @@ En ce qui concerne les autres arguments : \MiniSchemaSignesTkzTab[Code=pa-d+,Racines={-2/{\tfrac{5}{2}}},Couleur=orange]{3}[0.85][2] \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -1910,14 +2066,14 @@ Comme pour les autres commandes \TikZ, l'idée est de laisser l'utilisateur déf \subsection{Commandes} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} ... \begin{tikzpicture}[options] ... \ToileRecurrence[clés][options du tracé][options supplémentaires des termes] ... \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Plusieurs \Cle{arguments} (optionnels) sont disponibles : @@ -1967,10 +2123,10 @@ En effet, il y aurait trop d'options pour ces deux éléments, et l'idée est qu \begin{noteblock} On va tracer la \textit{toile} des 4 premiers termes de la suite récurrente :\\ -$\begin{dcases} u_1 = 1 \\ u_{n+1} = \sqrt{5u_n}+1 \text{ pour tout entier } n \geqslant 1\end{dcases}$. +\hfill$\begin{dcases} u_1 = 1 \\ u_{n+1} = \sqrt{5u_n}+1 \text{ pour tout entier } n \geqslant 1\end{dcases}$.\hfill~ \end{noteblock} -\begin{PresentationCodePL}{tikz lower} +\begin{PresCodePL}{tikz lower} %code tikz \def\x{1.5cm}\def\y{1.5cm} \def\xmin{0}\def\xmax{10}\def\xgrille{1}\def\xgrilles{0.5} @@ -1988,7 +2144,7 @@ $\begin{dcases} u_1 = 1 \\ u_{n+1} = \sqrt{5u_n}+1 \text{ pour tout entier } n \ %éléments supplémentaires \draw[very thick,blue,domain=0:8,samples=250] plot (\x,{\f}) ; \draw[very thick,ForestGreen,domain=0:8,samples=2] plot (\x,\x) ; -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} Peut-être que -- ultérieurement -- des options \textit{booléennes} seront disponibles pour un tracé \textit{générique} de la courbe et de la bissectrice, mais pour le moment la \textsf{macro} ne fait \textit{que} l'escalier. @@ -1996,7 +2152,7 @@ Peut-être que -- ultérieurement -- des options \textit{booléennes} seront dis \subsection{Influence des paramètres} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{center} \begin{tikzpicture}[x=4cm,y=3cm] %axes + grilles + graduations @@ -2011,9 +2167,9 @@ Peut-être que -- ultérieurement -- des options \textit{booléennes} seront dis \ToileRecurrence[Fct={\f},No=0,Uno=2,Nb=5,PosLabel=above right,DecalLabel=0pt] \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \begin{tikzpicture}[x=4cm,y=3cm] \draw[xstep=0.25,ystep=0.25,line width=0.3pt,lightgray!50] (0,0) grid (2.5,1.25); @@ -2034,9 +2190,9 @@ Peut-être que -- ultérieurement -- des options \textit{booléennes} seront dis \ToileRecurrence[Fct={\f},No=0,Uno=2,Nb=5,PosLabel=above right,DecalLabel=0pt] \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{center} \begin{tikzpicture}[x=5cm,y=1.5cm] ... @@ -2048,9 +2204,9 @@ Peut-être que -- ultérieurement -- des options \textit{booléennes} seront dis \draw[line width=1.25pt,red,domain=0.8:2.5,samples=250] plot(\x,{\f}); \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \begin{tikzpicture}[x=5cm,y=1.5cm] %axes et grille @@ -2071,7 +2227,139 @@ Peut-être que -- ultérieurement -- des options \textit{booléennes} seront dis \draw[line width=1.25pt,red,domain=0.8:2.5,samples=250] plot(\x,{\f}); \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} + +\newpage + +\section{Méthodes graphiques et intégrales}\label{integrtikz} + +\subsection{Idée} + +\begin{tipblock} +\cmaj{2.6.1} L'idée est de proposer plusieurs méthodes graphiques pour illustrer graphiquement une intégrale, via : +\begin{itemize} + \item une méthode des rectangles (Gauche, Droite ou Milieu) ; + \item la méthode des trapèzes. +\end{itemize} +La commande n'est pas autonome, elle est de ce fait à être placée dans un environnement \ctex{tikzpicture}. +\end{tipblock} + +\begin{PresCodeTexPL}{listing only} +%commande pour déclarer une fonction réutilisable +\DeclareFonctionTikz[nom]{expr} +\end{PresCodeTexPL} + +\begin{PresCodeTexPL}{listing only} +%environnement tikz +\IntegraleApprocheeTikz[clés]{nom_fonction}{a}{b} +\end{PresCodeTexPL} + +\subsection{Clés et arguments} + +\begin{cautionblock} +Plusieurs \Cle{Clés} sont disponibles pour la commande : + +\begin{itemize} + \item la clé \Cle{Epaisseur} pour l'épaisseur des \og figures \fg{} ; \hfill~défaut : \Cle{semithick} + \item la clé \Cle{Couleur} pour la couleur des \og figures \fg{} ; \hfill~défaut : \Cle{red} + \item le booléen \Cle{Remplir}, pour remplir les \og figures \fg{} ; \hfill~défaut : \Cle{true} + \item la clé \Cle{Opacite} pour l'opacité du remplissage des \og figures \fg{} ; + + \hfill~défaut : \Cle{0.25} + \item la clé \Cle{CouleurRemplissage} pour la couleur de remplissage des \og figures \fg{} ; + + \hfill~défaut : \Cle{Couleur!25} + \item la clé \Cle{Methode}, parmi \Cle{RectanglesGauche / RectanglesDroite / RectanglesMilieu / Trapezes} pour spécifier la méthode utilisée ; + + \hfill~défaut : \Cle{RectanglesGauche} + \item la clé \Cle{NbSubDiv} précise le nombre de \og figures \fg{}. \hfill~défaut : \Cle{10} +\end{itemize} + +\smallskip + +Concernant les arguments obligatoires : + +\begin{itemize} + \item le premier est la fonction , déclarée au préalable ; + \item les deux autres arguments sont les bornes de l'intégrale. +\end{itemize} + +Les commandes graphiques de \ctex{Proflycee} peuvent être utilisées pour configure la fenêtre ! +\end{cautionblock} + +\begin{PresCodePL}{} +\begin{tikzpicture}% + [x=0.66cm,y=0.033cm,xmin=0,xmax=21,xgrille=2,xgrilles=1,ymin=0,ymax=160,ygrille=20,ygrilles=10] + \DeclareFonctionTikz{80*\x*exp(-0.2*\x)} + \FenetreSimpleTikz{0,2,...,20}{0,20,...,160} + \CourbeTikz[very thick,samples=500,blue]{f(\x)}{1:20} + \IntegraleApprocheeTikz{f}{1}{20} + \draw[red] (10,160) node[below right] + {$\displaystyle% + \IntegraleApprochee[Methode=RectanglesGauche,AffFormule,Expr={80x\,\text{e}^{-0,2x}}]% + {80*x*exp(-0.2*x)}{1}{20}$} ; +\end{tikzpicture} +\end{PresCodePL} + +\begin{PresCodePL}{} +\begin{tikzpicture}% + [x=0.66cm,y=0.033cm,xmin=0,xmax=21,xgrille=2,xgrilles=1,ymin=0,ymax=160,ygrille=20,ygrilles=10] + \DeclareFonctionTikz{80*\x*exp(-0.2*\x)} + \FenetreSimpleTikz{0,2,...,20}{0,20,...,160} + \CourbeTikz[very thick,samples=500,blue]{f(\x)}{1:20} + \IntegraleApprocheeTikz[NbSubDiv=76]{f}{1}{20} + \draw[red] (10,160) node[below right] + {$\displaystyle\IntegraleApprochee% + [NbSubDiv=76,Methode=RectanglesGauche,AffFormule,Expr={80x\,\text{e}^{-0,2x}}]% + {80*x*exp(-0.2*x)}{1}{20}$} ; +\end{tikzpicture} +\end{PresCodePL} + +\pagebreak + +\subsection{Exemples} + +\begin{PresCodePL}{} +\begin{tikzpicture}% + [x=0.66cm,y=0.033cm,xmin=0,xmax=21,xgrille=2,xgrilles=1,ymin=0,ymax=160,ygrille=20,ygrilles=10] + \DeclareFonctionTikz{80*\x*exp(-0.2*\x)} + \FenetreSimpleTikz{0,2,...,20}{0,20,...,160} + \CourbeTikz[very thick,samples=500,blue]{f(\x)}{1:20} + \IntegraleApprocheeTikz[Methode=RectanglesDroite,Couleur=green]{f}{1}{20} + \draw[green] (10,160) node[below right] + {$\displaystyle\IntegraleApprochee% + [Methode=RectanglesDroite,AffFormule,Expr={80x\,\text{e}^{-0,2x}}]% + {80*x*exp(-0.2*x)}{1}{20}$} ; +\end{tikzpicture} +\end{PresCodePL} + +\begin{PresCodePL}{} +\begin{tikzpicture}% + [x=0.66cm,y=0.033cm,xmin=0,xmax=21,xgrille=2,xgrilles=1,ymin=0,ymax=160,ygrille=20,ygrilles=10] + \DeclareFonctionTikz{80*\x*exp(-0.2*\x)} + \FenetreSimpleTikz{0,2,...,20}{0,20,...,160} + \CourbeTikz[very thick,samples=500,blue]{f(\x)}{1:20} + \IntegraleApprocheeTikz[Methode=RectanglesMilieu,Couleur=purple]{f}{1}{20} + \draw[purple] (10,160) node[below right] + {$\displaystyle\IntegraleApprochee% + [Methode=RectanglesMilieu,AffFormule,Expr={80x\,\text{e}^{-0,2x}}]% + {80*x*exp(-0.2*x)}{1}{20}$} ; +\end{tikzpicture} +\end{PresCodePL} + +\begin{PresCodePL}{} +\begin{tikzpicture}% + [x=0.66cm,y=0.033cm,xmin=0,xmax=21,xgrille=2,xgrilles=1,ymin=0,ymax=160,ygrille=20,ygrilles=10] + \DeclareFonctionTikz{80*\x*exp(-0.2*\x)} + \FenetreSimpleTikz{0,2,...,20}{0,20,...,160} + \CourbeTikz[very thick,samples=500,blue]{f(\x)}{1:20} + \IntegraleApprocheeTikz[Methode=Trapezes,Couleur=orange]{f}{1}{20} + \draw[orange] (10,160) node[below right] + {$\displaystyle\IntegraleApprochee% + [Methode=Trapezes,AffFormule,Expr={80x\,\text{e}^{-0,2x}}]% + {80*x*exp(-0.2*x)}{1}{20}$} ; +\end{tikzpicture} +\end{PresCodePL} \newpage @@ -2115,17 +2403,17 @@ Donc, si plusieurs \textit{méthodes} sont utilisées pour insérer du code \tex L'environnement \ctex{CodePythonLst} permet de présenter du code \textsf{Python}, dans une \ctex{tcolorbox} avec deux styles particuliers (\cmaj{2.5.8}). \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythonLst}(*)[largeur]{commandes tcbox} ... \end{CodePythonLst} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythonLstAlt}(*)[largeur]{commandes tcbox} ... \end{CodePythonLstAlt} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Plusieurs \Cle{arguments} sont disponibles : @@ -2154,15 +2442,15 @@ Dans ce cas, il n'est pas nécessaire d'aligner le code \og à gauche \fg, en ut Si cette méthode est utilisée, il ne faut oublier de charger le package \ctex{scontents}. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \usepackage{scontents} %si script déclaré dans le fichier tex ... \CodePythonLstFichier(*)[largeur]{commandes tcbox}{script} -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Exemples} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythonLst}{} %les {}, même vides, sont nécessaires (bug avec # sinon !) #environnement par défaut nb = int(input("Saisir un entier positif")) @@ -2173,9 +2461,9 @@ if (nb %7 == 0) : def f(x) : return x**2 \end{CodePythonLst} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{CodePythonLst}{} #environnement par défaut nb = int(input("Saisir un entier positif")) @@ -2186,9 +2474,9 @@ if (nb %7 == 0) : def f(x) : return x**2 \end{CodePythonLst} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythonLstAlt}*[0.75\linewidth]{flush right} #largeur de 50%, sans numéro, et aligné à droite nb = int(input("Saisir un entier Python positif")) @@ -2199,9 +2487,9 @@ if (nb %7 == 0) : def f(x) : return x**2 \end{CodePythonLstAlt} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{CodePythonLstAlt}*[0.75\linewidth]{flush right} #largeur de 50%, sans numéro, et aligné à droite nb = int(input("Saisir un entier Python positif")) @@ -2212,9 +2500,9 @@ if (nb %7 == 0) : def f(x) : return x**2 \end{CodePythonLstAlt} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{scontents}[overwrite,write-out=testscript.py] # Calcul de la factorielle en langage Python def factorielle(x): @@ -2244,9 +2532,9 @@ def trace_parabole_tableaux(): %environnement centré, avec numéros, largeur 9cm \CodePythonLstFichier[9cm]{center}{testscript.py} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{scontents}[overwrite,write-out=testscript.py] # Calcul de la factorielle en langage Python def factorielle(x): @@ -2275,7 +2563,7 @@ def trace_parabole_tableaux(): \end{scontents} \CodePythonLstFichier[9cm]{center}{testscript.py} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -2289,10 +2577,10 @@ def trace_parabole_tableaux(): \cmaj{2.5.7} Une console \textsf{Python} est disponible, elle nécessite le package \ctex{pyluatex}, qui n'est pas chargé par \ctex{ProfLycee}, du fait de l'obligation de spécifier le \textit{chemin} pour l'exécutable \textsf{Python} ! \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \usepackage[executable=...]{pyluatex} %si utilisation de la console REPL \useproflyclib{piton} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{noteblock} La \textsf{librairie} \clib{piton} (qui charge \ctex{piton}, est compatible uniquement avec \hologo{LuaLaTeX} !) permet d'insérer du code \textsf{Python} avec une coloration syntaxique en utilisant la bibliothèque \textsf{Lua LPEG}. @@ -2324,11 +2612,11 @@ Ce package n'est chargé que si la compilation détectée est en \hologo{LuaLaTe \subsection{Présentation de code Python} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePiton}[options]{options tcbox} ... \end{CodePiton} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Plusieurs \Cle{clés} sont disponibles : @@ -2358,7 +2646,7 @@ Du fait du paramétrage des boîtes \ctex{tcolorbox}, il se peut que le rendu so Pour éviter des problèmes avec le code interprété par \textsf{piton}, les \ctex{\{\}} de l'argument obligatoire sont nécessaires au bon fonctionnement du code. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePiton}{} #environnement piton avec numéros de ligne, pleine largeur, style moderne def arctan(x,n=10): @@ -2369,7 +2657,7 @@ def arctan(x,n=10): else: return sum( (-1)**k/(2*k+1)*x**(2*k+1) for k in range(n) ) \end{CodePiton} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{CodePiton}{} #environnement piton avec numéros de ligne, pleine largeur, style moderne @@ -2382,7 +2670,7 @@ def arctan(x,n=10): return sum( (-1)**k/(2*k+1)*x**(2*k+1) for k in range(n) ) \end{CodePiton} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePiton}[Style=Classique,Filigrane]{} #environnement piton avec numéros, style classique, filigrane def arctan(x,n=10): @@ -2393,7 +2681,7 @@ def arctan(x,n=10): else: return sum( (-1)**k/(2*k+1)*x**(2*k+1) for k in range(n) ) \end{CodePiton} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{CodePiton}[Style=Classique,Filigrane]{} #environnement piton avec numéros, style classique, filigrane @@ -2406,7 +2694,7 @@ def arctan(x,n=10): return sum( (-1)**k/(2*k+1)*x**(2*k+1) for k in range(n) ) \end{CodePiton} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePiton}[Alignement=flush right,Largeur=13cm]{} def f(x) : return x**2 @@ -2433,7 +2721,7 @@ def f(x) : \end{CodePiton} \end{itemize} \vspace*{-\baselineskip}\leavevmode -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{CodePiton}[Alignement=flush right,Largeur=13cm]{} #avec numéros, de largeur 13cm, aligné à droite @@ -2480,12 +2768,12 @@ def f(x) : \cmaj{2.5.0} Cette section nécessite de charger les librairies \clib{minted} et/ou \clib{pythontex} dans le préambule. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \useproflyclib{minted} \useproflyclib{pythontex} %ou \useproflyclib{minted,pythontex} -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Introduction} @@ -2518,17 +2806,17 @@ Cela peut donner -- en tout cas -- des idées de personnalisation en ayant une b L'environnement \ctex{CodePythontex} est donc lié à \ctex{pythontex} (chargé par \ctex{ProfLycee}, avec l'option \textit{autogobble}) permet de présenter du code \textsf{Python}, dans une \ctex{tcolorbox} avec deux styles particuliers (\cmaj{2.5.8}). \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythontex}[options]{} %les {} vides sont nécessaires ... \end{CodePythontex} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythontexAlt}[options]{} %les {} vides sont nécessaires ... \end{CodePythontexAlt} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Comme précédemment, des \Cle{Clés} qui permettent de \textit{légèrement} modifier le style : @@ -2543,37 +2831,37 @@ Comme précédemment, des \Cle{Clés} qui permettent de \textit{légèrement} mo \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythontex}{} %bien mettre les {} !! #environnement Python(tex) par défaut def f(x) : return x**2 \end{CodePythontex} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{CodePythontex}{} #environnement Python(tex) par défaut def f(x) : return x**2 \end{CodePythontex} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythontexAlt}[Largeur=12cm,Centre,Lignes=false]{} #environnement Python(tex) classique, centré, sans lignes def f(x) : return x**2 \end{CodePythontexAlt} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{CodePythontexAlt}[Largeur=12cm,Centre,Lignes=false]{} #environnement Python(tex) classique, centré, sans lignes def f(x) : return x**2 \end{CodePythontexAlt} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Présentation de code Python via le package minted}\label{pytminted} @@ -2589,17 +2877,17 @@ Pour celles et ceux qui ne sont pas à l'aise avec le {package} \ctex{pythontex} Le package \ctex{minted} nécessite quand même une compilation avec l'option \ctex{--shell-escape} ou \ctex{-write18} ! \end{warningblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythonMinted}(*)[largeur]{options} ... \end{CodePythonMinted} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythonMintedAlt}(*)[largeur]{options} ... \end{CodePythonMintedAlt} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Plusieurs \Cle{arguments} sont disponibles : @@ -2612,37 +2900,37 @@ Plusieurs \Cle{arguments} sont disponibles : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythonMinted}[13cm]{center} #environnement Python(minted) centré avec numéros, de largeur 13cm def f(x) : return x**2 \end{CodePythonMinted} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{CodePythonMinted}[13cm]{center} #environnement Python(minted) centré avec numéros def f(x) : return x**2 \end{CodePythonMinted} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{CodePythonMintedAlt}*[0.8\linewidth]{} #environnement Python(minted), style alt, sans numéro, de largeur 0.8\linewidth def f(x) : return x**2 \end{CodePythonMintedAlt} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{CodePythonMintedAlt}*[0.8\linewidth]{} #environnement Python(minted), style alt, sans numéro, 0.8\linewidth def f(x) : return x**2 \end{CodePythonMintedAlt} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Console d'exécution Python} @@ -2652,11 +2940,11 @@ Plusieurs \Cle{arguments} sont disponibles : C'est l'environnement \ctex{ConsolePythontex} qui permet de le faire. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{ConsolePythontex}[options]{} %les {} vides sont nécessaires ... \end{ConsolePythontex} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Les \Cle{Clés} disponibles sont : @@ -2671,16 +2959,16 @@ Les \Cle{Clés} disponibles sont : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{ConsolePythontex}{} #console Python(tex) par défaut from math import sqrt 1+1 sqrt(12) \end{ConsolePythontex} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \smallskip \begin{ConsolePythontex}{} #console Python(tex) par défaut @@ -2688,9 +2976,9 @@ Les \Cle{Clés} disponibles sont : 1+1 sqrt(12) \end{ConsolePythontex} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{ConsolePythontex}[Largeur=14cm,Label=false,Centre]{} #console Python(tex) centrée sans label, 14cm table = [[1,2],[3,4]] @@ -2701,9 +2989,9 @@ Les \Cle{Clés} disponibles sont : tableau len(tableau), len(tableau[0]), tableau[1][4] \end{ConsolePythontex} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \smallskip \begin{ConsolePythontex}[Largeur=14cm,Label=false,Centre]{} #console Python(tex) centrée sans label, 14cm @@ -2715,7 +3003,7 @@ Les \Cle{Clés} disponibles sont : tableau len(tableau), len(tableau[0]), tableau[1][4] \end{ConsolePythontex} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{noteblock} Le package \ctex{pythontex} peut donc servir à présenter du code Python, comme \ctex{minted} ou \ctex{piton}, sa particularité est toutefois de pouvoir \textit{exécuter} du code \textsf{Python} pour une présentation de type \textit{console}. @@ -2741,19 +3029,19 @@ Les environnements \ctex{PseudoCode} ou \ctex{PseudoCodeAlt} permet de présente De plus, le package \ctex{listings} avec \ctex{tcolorbox} ne permet pas de gérer le paramètre \textit{autogobble}, donc il faudra être vigilant quant à la position du code (pas de tabulation en fait\ldots) \end{warningblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{PseudoCode}(*)[largeur]{options tcbox} %attention à l'indentation, gobble ne fonctionne pas... ... \end{PseudoCode} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{PseudoCodeAlt}(*)[largeur]{options tcbox} %attention à l'indentation, gobble ne fonctionne pas... ... \end{PseudoCodeAlt} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Plusieurs \Cle{arguments} (optionnels) sont disponibles : @@ -2766,7 +3054,7 @@ Plusieurs \Cle{arguments} (optionnels) sont disponibles : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %en pas oublier les {}, même vides ! \begin{PseudoCode}{} %non centré, de largeur par défaut (12cm) avec lignes List = [...] # à déclarer au préalable @@ -2775,9 +3063,9 @@ Pour i allant de 0 à n-1 Faire Afficher(List[i]) FinPour \end{PseudoCode} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{PseudoCode}{} List = [...] # à déclarer au préalable n = longueur(List) @@ -2785,9 +3073,9 @@ Pour i allant de 0 à n-1 Faire Afficher(List[i]) FinPour \end{PseudoCode} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{PseudoCodeAlt}[15cm]{center} %centré, de largeur 15cm List = [...] # à déclarer au préalable n = longueur(List) @@ -2795,9 +3083,9 @@ Pour i allant de 0 à n-1 Faire Afficher(List[i]) FinPour \end{PseudoCodeAlt} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{PseudoCodeAlt}[15cm]{center} List = [...] # à déclarer au préalable n = longueur(List) @@ -2805,7 +3093,7 @@ Pour i allant de 0 à n-1 Faire Afficher(List[i]) FinPour \end{PseudoCodeAlt} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Compléments} @@ -2821,21 +3109,21 @@ Le style \ctex{listings} utilisé par la commande a l'option \Cle{mathescape} ac Cela permet d'insérer du code \LaTeX{} dans l'environnement \ctex{PseudoCode} (attention au fontes par contre !). \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{PseudoCode}*[12cm]{} #Utilisation du mode mathescape Afficher (*\og*) .........(*\fg*) m = (*$\tfrac{\texttt{1}}{\texttt{2}}$*) \end{PseudoCode} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{PseudoCode}*[12cm]{} #Utilisation du mode mathescape Afficher (*\og*) .........(*\fg*) m = (*$\tfrac{\texttt{1}}{\texttt{2}}$*) \end{PseudoCode} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -2861,7 +3149,7 @@ Comme pour le pseudo-code, pas d'\textsf{autogobble}, donc commandes à aligner \subsection{Commandes} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{TerminalWin}[largeur]{titre=...}[options tcbox] ... \end{TerminalWin} @@ -2873,7 +3161,7 @@ Comme pour le pseudo-code, pas d'\textsf{autogobble}, donc commandes à aligner \begin{TerminalOSX}[largeur]{titre=...}[options tcbox] ... \end{TerminalOSX} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Peu d'options pour ces commandes : @@ -2892,21 +3180,21 @@ Le \textsf{code} n'est pas formaté, ni mis en coloration syntaxique. De ce fait tous les caractères sont autorisés : même si l'éditeur pourra détecter le \% comme le début d'un commentaire, tout sera intégré dans le code mis en forme ! \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{TerminalUnix}[12cm]{Titre=Terminal Ubuntu}[center] %12cm, avec titre modifié et centré test@DESKTOP:~$ ping -c 2 ctan.org PING ctan.org (5.35.249.60) 56(84) bytes of data. \end{TerminalUnix} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{TerminalUnix}[12cm]{Titre=Terminal Ubuntu}[center] test@DESKTOP:~$ ping -c 2 ctan.org PING ctan.org (5.35.249.60) 56(84) bytes of data. \end{TerminalUnix} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{TerminalWin}[15cm]{} %largeur 15cm avec titre par défaut Microsoft Windows [version 10.0.22000.493] (c) Microsoft Corporation. Tous droits réservés. @@ -2928,9 +3216,9 @@ Minimum = 35ms, Maximum = 39ms, Moyenne = 36ms [test@server]$ ping -c 2 ctan.org PING ctan.org (5.35.249.60) 56(84) bytes of data. \end{TerminalOSX} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{TerminalWin}[15cm]{} Microsoft Windows [version 10.0.22000.493] (c) Microsoft Corporation. Tous droits réservés. @@ -2957,7 +3245,7 @@ PING ctan.org (5.35.249.60) 56(84) bytes of data. [test@server]$ ping -c 2 ctan.org PING ctan.org (5.35.249.60) 56(84) bytes of data. \end{TerminalOSX} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -2971,9 +3259,9 @@ L'idée est d'obtenir des \textsf{cartouches} tels que \textsf{Capytale} les pr \subsection{Commandes} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \CartoucheCapytale(*)[options]{code capytale} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Peu d'options pour ces commandes : @@ -2988,7 +3276,7 @@ Peu d'options pour ces commandes : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \CartoucheCapytale{abcd-12345} %lien simple, en sf \CartoucheCapytale[~]{abcd-12345} %lien avec ~ à la fin, en sf @@ -2996,9 +3284,9 @@ Peu d'options pour ces commandes : \CartoucheCapytale*{abcd-12345} %lien simple, en tt \CartoucheCapytale*[~]{abcd-12345} %lien avec ~ à la fin, en tt -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \CartoucheCapytale{abcd-12345} \CartoucheCapytale[~]{abcd-12345} @@ -3006,22 +3294,22 @@ Peu d'options pour ces commandes : \CartoucheCapytale*{abcd-12345} \CartoucheCapytale*[~]{abcd-12345} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{noteblock} Le \textsf{cartouche} peut être \og cliquable \fg{} grâce à \ctex{href}. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \usepackage{hyperref} \urlstyle{same} ... \href{https://capytale2.ac-paris.fr/web/c/abcd-12345}{\CartoucheCapytale{abcd-12345}} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \href{https://capytale2.ac-paris.fr/web/c/abcd-12345}{\CartoucheCapytale{abcd-12345}} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -3039,11 +3327,11 @@ Il s'agir d'un environnement créé en \ctex{tcolorbox}, et utilisant la présen \subsection{Commandes} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{PresentationCode}[Couleur]{options tcbox} ... \end{PresentationCode} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Peu de personnalisations pour ces commandes : @@ -3063,7 +3351,7 @@ Il est à noter que, même dans le cas d'option vide pour la \ctex{tcolorbox}, l On peut par exemple utiliser l'option \Cle{listing only} pour ne présenter \textit{que} le code source. \end{noteblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \begin{PresentationCode}{} \xdef\ValAleaA{\fpeval{randint(1,100)}} \xdef\ValAleaB{\fpeval{randint(1,100)}} @@ -3074,7 +3362,7 @@ Avec $A=\ValAleaA$ et $B=\ValAleaB$, on a $A\times B=\inteval{\ValAleaA * \ValAl \begin{PresentationCode}[DarkBlue]{} On peut faire beaucoup de choses avec \LaTeX{} ! \end{PresentationCode} -\end{PresentationCodePL} +\end{PresCodePL} \pagebreak @@ -3100,12 +3388,12 @@ L'idée est d'obtenir un pavé droit, dans un environnement \TikZ, avec les nœu \subsection{Commandes} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture}[options tikz] \PaveTikz[options] ... \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Quelques \Cle{clés} sont disponibles pour cette commande : @@ -3128,15 +3416,15 @@ Quelques \Cle{clés} sont disponibles pour cette commande : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{tikz lower} +\begin{PresCodePL}{tikz lower} %code tikz \PaveTikz -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{tikz lower} +\begin{PresCodePL}{tikz lower} %code tikz \PaveTikz[Cube,Largeur=2] -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} La ligne est de ce fait à insérer dans un environnement \TikZ, avec les options au choix pour cet environnement. @@ -3146,19 +3434,19 @@ Le code crée les nœuds relatifs aux sommets, et les nomme comme les sommets, c \subsection{Influence des paramètres} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture}[line join=bevel] \PaveTikz[Aff,Largeur=4,Profondeur=3,Hauteur=2,Epaisseur={ultra thick}] \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{tikzpicture}[line join=bevel] \PaveTikz[Aff,Largeur=4,Profondeur=3,Hauteur=2,Epaisseur={ultra thick}] \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{center} \begin{tikzpicture}[line join=bevel] \PaveTikz[Plein,Aff,Largeur=7,Profondeur=3.5,Hauteur=4,Sommets=Q§S§D§F§G§H§J§K] @@ -3166,9 +3454,9 @@ Le code crée les nœuds relatifs aux sommets, et les nomme comme les sommets, c \draw[thick,blue,densely dotted] (K)--(H) ; \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \begin{tikzpicture}[line join=bevel] \PaveTikz[Plein,Aff,Largeur=7,Profondeur=3.5,Hauteur=4,Sommets=Q§S§D§F§G§H§J§K] @@ -3176,7 +3464,7 @@ Le code crée les nœuds relatifs aux sommets, et les nomme comme les sommets, c \draw[thick,blue,densely dotted] (K)--(H) ; \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -3190,12 +3478,12 @@ L'idée est d'obtenir un tétraèdre, dans un environnement \TikZ, avec les nœu \subsection{Commandes} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture}[options tikz] \TetraedreTikz[options] ... \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Quelques \Cle{clés} sont disponibles pour cette commande : @@ -3215,20 +3503,20 @@ Quelques \Cle{clés} sont disponibles pour cette commande : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{tikz lower} +\begin{PresCodePL}{tikz lower} %code tikz \TetraedreTikz -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{tikz lower} +\begin{PresCodePL}{tikz lower} %code tikz \TetraedreTikz[Aff,Largeur=2,Profondeur=0.625,Hauteur=1.5] -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{tikz lower} +\begin{PresCodePL}{tikz lower} %code tikz \TetraedreTikz[Plein,Aff,Largeur=5,Beta=60] -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Influence des paramètres} @@ -3249,23 +3537,23 @@ Pour \textit{illustrer} un peu les \Cle{clés}, un petit schéma, avec les diff \end{center} \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{center} \begin{tikzpicture}[line join=bevel] \TetraedreTikz[Aff,Largeur=7,Profondeur=3,Hauteur=5,Epaisseur={ultra thick},Alpha=20,Beta=30] \draw[very thick,ForestGreen,<->,>=latex] ($(A)!0.5!(D)$)--($(B)!0.5!(D)$) ; \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \begin{tikzpicture}[line join=bevel] \TetraedreTikz[Aff,Largeur=7,Profondeur=3,Hauteur=5,Epaisseur={ultra thick},Alpha=20,Beta=30] \draw[very thick,ForestGreen,<->,>=latex] ($(A)!0.5!(D)$)--($(B)!0.5!(D)$) ; \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -3281,21 +3569,21 @@ L'idée est d'obtenir une commande pour tracer (en \TikZ) un cercle trigonométr Comme pour les autres commandes \TikZ, l'idée est de laisser l'utilisateur définir et créer son environnement \TikZ, et d'insérer la commande \ctex{CercleTrigo} pour afficher le cercle. \end{tipblock} -\begin{PresentationCodePL}{tikz lower} +\begin{PresCodePL}{tikz lower} %code tikz \CercleTrigo -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Commandes} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} ... \begin{tikzpicture}[options tikz] ... \CercleTrigo[clés] ... \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Plusieurs \Cle{Clés} sont disponibles pour cette commande : @@ -3318,7 +3606,7 @@ Plusieurs \Cle{Clés} sont disponibles pour cette commande : \pagebreak -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{center} \begin{tikzpicture}[line join=bevel] \CercleTrigo[Rayon=2.5,AffValeurs=false,Decal=8pt] @@ -3332,9 +3620,9 @@ Plusieurs \Cle{Clés} sont disponibles pour cette commande : \CercleTrigo[Rayon=2.5,MoinsPi=false,CouleurFond=orange!15] \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \begin{tikzpicture}[line join=bevel] \CercleTrigo[Rayon=2.5,AffValeurs=false,Decal=8pt] @@ -3348,7 +3636,7 @@ Plusieurs \Cle{Clés} sont disponibles pour cette commande : \CercleTrigo[Rayon=2.5,MoinsPi=false,CouleurFond=orange!15,TailleValeurs=\tiny] \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Équations trigos} @@ -3369,7 +3657,7 @@ Les \Cle{Clés} pour cette possibilité sont : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{center} \begin{tikzpicture} \CercleTrigo[% @@ -3388,9 +3676,9 @@ Les \Cle{Clés} pour cette possibilité sont : AffTraits=false,AffAngles=false,Rayon=2.5,Equationcos,cos=60,CouleurSol=purple, TailleValeurs=\tiny] \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \begin{tikzpicture} \CercleTrigo[% @@ -3409,7 +3697,7 @@ Les \Cle{Clés} pour cette possibilité sont : AffTraits=false,AffAngles=false,Rayon=2.5,Equationcos,cos=60,CouleurSol=purple,TailleValeurs=\tiny] \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -3423,12 +3711,12 @@ L'idée est de \textit{proposer} un style \textit{tout prêt} pour simuler un tr Il s'agit d'un style \textit{basique} utilisant la librairie \ctex{decorations} avec \textsf{random steps}. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \tikzset{% mainlevee/.style args={#1et#2}{decorate,decoration={random steps, segment length=#1,amplitude=#2}}, mainlevee/.default={5mm et 0.6pt} } -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Utilisation basique} @@ -3447,7 +3735,7 @@ Concernant le style en lui-même, deux paramètres peuvent être précisés via Les valeurs \Cle{mainlevee=5mm et 0.6pt} donnent des résultats -- à mon sens -- satisfaisants, mais l'utilisateur pourra modifier à loisir ces paramètres ! \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %la grille a été rajoutée pour la sortie \begin{tikzpicture} \draw[thick,mainlevee] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ; @@ -3460,9 +3748,9 @@ Les valeurs \Cle{mainlevee=5mm et 0.6pt} donnent des résultats -- à mon sens - \begin{tikzpicture} \draw[thick,mainlevee=10mm et 3mm] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ; \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \hfill~\begin{tikzpicture} \draw[xstep=0.5,ystep=0.5,ultra thin,lightgray] (0,0) grid (4,4); \draw[thick,mainlevee] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ; @@ -3478,7 +3766,7 @@ Les valeurs \Cle{mainlevee=5mm et 0.6pt} donnent des résultats -- à mon sens - \draw[thick,mainlevee=10mm et 3mm] (0,0) --++ (4,0) --++ (0,4) --++ (-4,0) --cycle ; \end{tikzpicture} \hfill~ -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -3517,11 +3805,11 @@ L'idée est que cette macro calcule et stocke les paramètres dans des variables \vspace*{-\baselineskip}\leavevmode \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} ... \CalculsRegLin[clés]{listeX}{listeY} %listes avec éléments séparés par des , ... -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{noteblock} La commande \ctex{CalculsRegLin} va définir également des \textsf{macros} pour chaque coefficient, qui de ce fait seront réutilisables après ! @@ -3543,14 +3831,14 @@ Quelques \Cle{Clés} sont disponibles pour cette commande, essentiellement pour \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %les espaces verticaux n'ont pas été écrits ici \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008, 2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661, 1656,1649} \CalculsRegLin{\LLX}{\LLY} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %vérif des calculs (noms non modifiables...) Liste des X := \showitems\LX. Liste des Y := \showitems\LY. @@ -3564,9 +3852,9 @@ Coefficient $a=\COEFFa$. Coefficient $b=\COEFFb$. Coefficient $r=\COEFFr$. Coefficient $r^2=\COEFFrd$. -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} \CalculsRegLin{\LLX}{\LLY} @@ -3612,7 +3900,7 @@ Coefficient $r=\COEFFr$.\tabto{0.5\textwidth}Coefficient $r^2=\COEFFrd$. %\smallskip % %Coefficient $r^2=\COEFFrd$. -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{noteblock} \hfill~\includegraphics[height=3cm]{./graphics/pl-doc-stats_a}~~\includegraphics[height=3cm]{./graphics/pl-doc-stats_b}~~\includegraphics[height=3cm]{./graphics/pl-doc-stats_c}~~\includegraphics[height=3cm]{./graphics/pl-doc-stats_c2}\hfill~ @@ -3622,7 +3910,7 @@ Coefficient $r=\COEFFr$.\tabto{0.5\textwidth}Coefficient $r^2=\COEFFrd$. Les \textsf{macros} qui contiennent les paramètres de la régression sont donc réutilisables, en tant que nombres réels, donc exploitables par \ctex{siunitx} et \ctex{xfp} pour affichage \textit{fin} ! Ci-dessous un exemple permettant de visualiser tout cela. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %les espaces verticaux n'ont pas été écrits ici \def\LstX{0,1,3,4,5,6} \def\LstY{-35,-37.4,-37.7,-39.9,-39,-39.6} @@ -3636,9 +3924,9 @@ Les \textsf{macros} qui contiennent les paramètres de la régression sont donc %paramètres Les valeurs extr. de X sont \TESTmin{} et \TESTmax. Une éq. est $y=\arrond[3]{\TESTa}x \arrond*[3]{\TESTb}$. Le coeff. de corrélation est $r=\arrond[4]{\TESTr}$, et son carré est $r^2=\arrond[4]{\TESTrd}$. -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \def\LstX{0,1,3,4,5,6}\def\LstY{-35,-37.4,-37.7,-39.9,-39,-39.6} \CalculsRegLin[NomCoeffa=TESTa,NomCoeffb=TESTb,NomCoeffr=TESTr,NomCoeffrd=TESTrd,NomXmin=TESTmin,NomXmax=TESTmax]{\LstX}{\LstY} \DeclareDocumentCommand\arrond{ s O{3} m }{ @@ -3653,7 +3941,7 @@ Les valeurs extrêmes de $x$ sont \TESTmin{} et \TESTmax. Une équation de la dr \smallskip Le coefficient de corrélation linéaire est $r=\arrond[4]{\TESTr}$, et son carré est $r^2=\arrond[4]{\TESTrd}$. -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{noteblock} \hfill~\includegraphics[height=3cm]{./graphics/pl-doc-stats_d}~~\includegraphics[height=3cm]{./graphics/pl-doc-stats_e}\hfill~ @@ -3665,7 +3953,7 @@ Le coefficient de corrélation linéaire est $r=\arrond[4]{\TESTr}$, et son carr La commande étant \og autonome \fg{}, elle va pouvoir être intégrée dans des environnements graphiques pour permettre un tracé \textit{facile} de la droite de régression. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture} \begin{axis}[options des axes, non présentées ici...] \addplot[teal, only marks] table{ @@ -3681,9 +3969,9 @@ La commande étant \og autonome \fg{}, elle va pouvoir être intégrée dans des \addlegendentry{$R^2=\fpeval{round(\COEFFrd,5)}$}; \end{axis} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{tikzpicture} \begin{axis}[ /pgf/number format/.cd, @@ -3732,20 +4020,20 @@ La commande étant \og autonome \fg{}, elle va pouvoir être intégrée dans des \addlegendentry{$R^2=\fpeval{round(\COEFFrd,5)}$}; \end{axis} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{noteblock} Il existe également une commande auxiliaire, \ctex{PointsRegLin} pour afficher le nuage de points avec quelques options, dans un environnement \TikZ{} classique (sans \textsf{pgfplot})\ldots \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} ... \begin{tikzpicture}[ ] ... \PointsRegLin[clés]{listeX}{listeY} ... \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Quelques \Cle{Clés} sont disponibles pour cette commande, essentiellement pour la mise en forme du nuage : @@ -3759,7 +4047,7 @@ Quelques \Cle{Clés} sont disponibles pour cette commande, essentiellement pour \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture}[x=0.5cm,y=0.05cm] \draw[xstep=1,ystep=5,lightgray!50,very thin] (0,0) grid (20,100); \draw[xstep=2,ystep=10,lightgray,thin] (0,0) grid (20,100); @@ -3778,9 +4066,9 @@ Quelques \Cle{Clés} sont disponibles pour cette commande, essentiellement pour \node {$R^2=\num{\fpeval{round(\COEFFrd,5)}}$} ; \\ }; \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{tikzpicture}[x=0.5cm,y=0.05cm] \draw[xstep=1,ystep=5,lightgray!50,very thin] (0,0) grid (20,100); \draw[xstep=2,ystep=10,lightgray,thin] (0,0) grid (20,100); @@ -3799,7 +4087,7 @@ Quelques \Cle{Clés} sont disponibles pour cette commande, essentiellement pour \node {$R^2=\num{\fpeval{round(\COEFFrd,5)}}$} ; \\ }; \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -3843,14 +4131,14 @@ En utilisant les commandes de \textsf{régression linéaire} du paragraphe préc Le package \ctex{pgfplots} peut être utilisé pour traiter ce genre de situation, mais ne l'utilisant pas, j'ai préféré préparer des \textsf{macros} permettant de s'affranchir de ce package (est-ce pertinent, ça c'est une autre question\ldots). \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %Listes et calculs \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008, 2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661, 1656,1649} \CalculsRegLin{\LLX}{\LLY} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %tracé (simple), les options seront présentées juste après \begin{tikzpicture}% [x=0.5cm,y=0.1cm, %unités @@ -3864,9 +4152,9 @@ Le package \ctex{pgfplots} peut être utilisé pour traiter ce genre de situatio {\COEFFa*\x+\COEFFb}{\LXmin:\LXmax} %droite de régression \PointMoyenTikz %point moyen \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %tracé avec options fenêtre par défaut \begin{tikzpicture}% [....] %paramètres @@ -3876,9 +4164,9 @@ Le package \ctex{pgfplots} peut être utilisé pour traiter ce genre de situatio {\COEFFa*\x+\COEFFb}{\LXmin:\LXmax} %droite de régression \PLnuageptmoy %point moyen \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} \CalculsRegLin{\LLX}{\LLY} @@ -3891,7 +4179,7 @@ Le package \ctex{pgfplots} peut être utilisé pour traiter ce genre de situatio \CourbeTikz[line width=1.25pt,ForestGreen,samples=2]{\COEFFa*\x+\COEFFb}{\LXmin:\LXmax} \PointMoyenTikz \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Commandes, clés et options} @@ -3906,7 +4194,7 @@ Les \Cle{paramètres} nécessaires à la bonne utilisation des commandes suivant \item \Cle{xgrilles}, stockée dans \ctex{\textbackslash{}xgrilles}, graduation secondaire.\hfill{}défaut \Cle{0.5} \end{itemize} -La fenêtre d'affichage (de sortie) sera donc \textit{portée} par le rectangle de coins $(\text{xmin}\,;\,\text{ymin})$ et $(\text{xmax}\,;\,\text{ymax})$ ; ce qui correspond en fait à la fenêtre \TikZ{} \textit{portée} par le rectangle de coins $(xmin-Ox\,;\,ymin-Oy)$ et $(\text{xmax-Ox}\,;\,\text{ymax-Oy})$. +La fenêtre d'affichage (de sortie) sera donc \textit{portée} par le rectangle de coins $(\text{xmin};\text{ymin})$ et $(\text{xmax};\text{ymax})$ ; ce qui correspond en fait à la fenêtre \TikZ{} \textit{portée} par le rectangle de coins $(\text{xmin-Ox};\text{ymin-Oy})$ et $(\text{xmax-Ox};\text{ymax-Oy})$. \smallskip @@ -3917,10 +4205,10 @@ Les commandes ont -- pour certaines -- pas mal de \Cle{clés} pour des réglages Pour illustrer les commandes et options de ce paragraphe, la base sera le graphique présenté précédemment. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %...code tikz \GrilleTikz[options][options grille ppale][options grille second.] -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Cette commande permet de tracer une grille principale et/ou une grille secondaire : @@ -3934,7 +4222,7 @@ Cette commande permet de tracer une grille principale et/ou une grille secondair \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \begin{tikzpicture}% [x=0.3cm,y=0.06cm,% Ox=1992,xmin=1992,xmax=2012,xgrille=2,xgrilles=1,% @@ -3948,9 +4236,9 @@ Cette commande permet de tracer une grille principale et/ou une grille secondair Oy=1640,ymin=1640,ymax=1730,ygrille=10,ygrilles=5] \GrilleTikz[Affp=false][][orange,densely dotted] \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \hfill~ \begin{tikzpicture}% [x=0.3cm,y=0.06cm,% @@ -3966,12 +4254,12 @@ Cette commande permet de tracer une grille principale et/ou une grille secondair \GrilleTikz[Affp=false][][orange,densely dotted] \end{tikzpicture} \hfill~ -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %...code tikz \AxesTikz[options] -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Cette commande permet de tracer les axes, avec des \Cle{clés} : @@ -3998,7 +4286,7 @@ Cette commande permet de tracer les axes, avec des \Cle{clés} : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %code tikz \AxesTikz @@ -4007,9 +4295,9 @@ Cette commande permet de tracer les axes, avec des \Cle{clés} : [AffLabel=xy,Labelx={Année},Labely={Altitude},% PosLabelx={below right},PosLabely={above left},% Police=\small\sffamily] -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \hfill~ \begin{tikzpicture}% [x=0.3cm,y=0.06cm,% @@ -4028,15 +4316,15 @@ Cette commande permet de tracer les axes, avec des \Cle{clés} : Police=\small\sffamily] \end{tikzpicture} \hfill~ -\end{PresentationCodePL} +\end{PresCodeSortiePL} %les axes -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %...code tikz \AxexTikz[options]{valeurs} \AxeyTikz[options]{valeurs} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} identiques pour les deux directions : @@ -4053,7 +4341,7 @@ Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} ide \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %code tikz \AxexTikz[Police=\small]{1992,1994,...,2010} \AxexTikz{1640,1650,...,1720} @@ -4063,9 +4351,9 @@ Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} ide \AxeyTikz[AffGrad=false,HautGrad=6pt]{1640,1650,...,1720} %des axes fictifs (en gris) sont rajoutés pour la lisibilité du code de sortie -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \hfill~ \begin{tikzpicture}% [x=0.3cm,y=0.06cm,% @@ -4087,7 +4375,7 @@ Ces commande permet de tracer les graduations des axes, avec des \Cle{clés} ide \AxeyTikz[AffGrad=false,HautGrad=6pt]{1640,1650,...,1720} \end{tikzpicture} \hfill~ -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Commandes annexes} @@ -4102,25 +4390,18 @@ Il existe, de manière marginale, quelques commandes complémentaires qui ne ser \vspace*{-\baselineskip}\leavevmode \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %code tikz \FenetreTikz %on restreint les tracés \FenetreSimpleTikz[opt](opt axes) {liste valx} {liste valy} -\end{PresentationCodePL} - -%%l'origine -% -%\begin{PresentationCodePL}{listing only} -%%...code tikz -% \PLorigine[ ] -%\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Interactions avec CalculsRegLin} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %...code tikz \NuagePointsTikz[options]{listeX}{listeY} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Cette commande, liée à la commande \ctex{CalculsRegLin} permet de représenter le nuage de points associé aux deux listes, avec les \Cle{clés} suivantes : @@ -4133,7 +4414,7 @@ Cette commande, liée à la commande \ctex{CalculsRegLin} permet de représenter \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008, 2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661, 1656,1649} @@ -4144,9 +4425,9 @@ Cette commande, liée à la commande \ctex{CalculsRegLin} permet de représenter \begin{tikzpicture}[...] \NuagePointsTikz[Couleur=ForestGreen,Style=x,Taille=6pt]{\LLX}{\LLY} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} \CalculsRegLin{\LLX}{\LLY} @@ -4164,13 +4445,13 @@ Cette commande, liée à la commande \ctex{CalculsRegLin} permet de représenter \AxeyTikz{1640,1650,...,1720} \NuagePointsTikz[Couleur=ForestGreen,Style=x,Taille=6pt]{\LLX}{\LLY} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} %point moyen -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %...code tikz \PointMoyenTikz[options] -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Cette commande permet de rajouter le point moyen du nuage, calculé par la commande \ctex{CalculsRegLin}, avec les \Cle{clés} : @@ -4190,7 +4471,7 @@ Cette commande permet de rajouter le point moyen du nuage, calculé par la comma \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008, 2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661, 1656,1649} \CalculsRegLin{\LLX}{\LLY} @@ -4204,9 +4485,9 @@ Cette commande permet de rajouter le point moyen du nuage, calculé par la comma \NuagePointsTikz[Couleur=ForestGreen,Style=x,Taille=6pt]{\LLX}{\LLY} \PointMoyenTikz[Couleur=orange,Taille=8pt,Style=+,Nom={$G_1$},Pos=below] \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} \CalculsRegLin{\LLX}{\LLY} @@ -4226,13 +4507,13 @@ Cette commande permet de rajouter le point moyen du nuage, calculé par la comma \NuagePointsTikz[Couleur=ForestGreen,Style=x,Taille=6pt]{\LLX}{\LLY} \PointMoyenTikz[Couleur=orange,Taille=8pt,Style=+,Nom={$G_1$},Pos=below] \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} %courbe -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %...code tikz \CourbeTikz[options]{formule}{domaine} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Cette commande permet de rajouter une courbe sur le graphique (sans se soucier de la transformation de son expression) avec les arguments : @@ -4253,7 +4534,7 @@ L'idée principale est de récupérer les variables de la régression linéaire Toute courbe peut être tracée sur ce principe, par contre il faudra saisir la fonction \textit{à la main}. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008, 2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661, 1656,1649} \CalculsRegLin{\LLX}{\LLY} @@ -4262,9 +4543,9 @@ L'idée principale est de récupérer les variables de la régression linéaire \NuagePointsTikz[Couleur=blue/red]{\LLX}{\LLY} \PointMoyenTikz \CourbeTikz[line width=1.25pt,ForestGreen,samples=2]{\COEFFa*\x+\COEFFb}{\xmin:\xmax} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} \CalculsRegLin{\LLX}{\LLY} @@ -4276,11 +4557,11 @@ L'idée principale est de récupérer les variables de la régression linéaire \NuagePointsTikz[Couleur=blue/red]{\LLX}{\LLY} \PointMoyenTikz \CourbeTikz[line width=1.25pt,ForestGreen,samples=2]{\COEFFa*\x+\COEFFb}{\xmin:\xmax} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Exemple complémentaire, pour illustration} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} @@ -4291,9 +4572,9 @@ L'idée principale est de récupérer les variables de la régression linéaire \NuagePointsTikz[Couleur=blue/red]{\LLX}{\LLY} \FenetreTikz %on fixe la fenêtre \CourbeTikz[line width=1.25pt,orange,samples=250]{-(\x-2000)*(\x-2000)+1700}{\xmin:\xmax} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \def\LLX{1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010} \def\LLY{1718,1710,1708,1700,1698,1697,1691,1688,1683,1679,1671,1670,1663,1661,1656,1649} @@ -4304,7 +4585,7 @@ L'idée principale est de récupérer les variables de la régression linéaire \NuagePointsTikz[Couleur=blue/red]{\LLX}{\LLY} \FenetreTikz \CourbeTikz[line width=1.25pt,orange,samples=250]{-(\x-2000)*(\x-2000)+1700}{\xmin:\xmax} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -4320,11 +4601,11 @@ L'idée est de proposer une commande, à intégrer dans un environnement \TikZ, Le code ne calcule pas les paramètres, il ne fait \textit{que} tracer la boîte à moustaches ! \end{tipblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \begin{tikzpicture} \BoiteMoustaches{10/15/17/19/20} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} Étant donnée que la commande est intégrée dans un environnement \TikZ, les unités peuvent/doivent donc être précisées, \textit{comme d'habitude}, si besoin. @@ -4353,14 +4634,14 @@ Quelques \Cle{clés} sont disponibles pour cette commande : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \begin{tikzpicture} \BoiteMoustaches[Epaisseur=very thick,Moyenne=18.5,Couleur=blue,AffMoyenne,% Pointilles,Valeurs,Hauteur=2.25,Elevation=2]{10/15/17/19/20} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %une grille a été rajoutée pour visualiser la "position verticale" \begin{center} \begin{tikzpicture}[x=0.1cm] @@ -4370,9 +4651,9 @@ Quelques \Cle{clés} sont disponibles pour cette commande : [Elevation=4,Couleur=ForestGreen,Remplir=ForestGreen!25]{100/140/145/160/210} \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{center} \begin{tikzpicture}[x=0.1cm] \draw[xstep=10,ystep=0.5,very thin,lightgray] (80,0) grid (210,4.5) ; @@ -4383,7 +4664,7 @@ Quelques \Cle{clés} sont disponibles pour cette commande : \BoiteMoustaches[Elevation=4,Couleur=ForestGreen,Remplir=ForestGreen!25]{100/140/145/160/210} \end{tikzpicture} \end{center} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Commande pour placer un axe horizontal} @@ -4391,19 +4672,19 @@ Quelques \Cle{clés} sont disponibles pour cette commande : L'idée est de proposer, en parallèle de la commande précédente, une commande pour tracer un axe horizontal \og sous \fg{} les éventuelles boîtes à moustaches. \end{tipblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \begin{tikzpicture} \BoiteMoustachesAxe[Min=10,Max=20] \BoiteMoustaches{10/15/17/19/20} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \begin{tikzpicture} \BoiteMoustachesAxe[Min=10,Max=20] \BoiteMoustaches[Valeurs,Pointilles]{10/15/17/19/20} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodePL} \begin{cautionblock} Quelques \Cle{clés} sont disponibles pour cette commande : @@ -4418,14 +4699,14 @@ Quelques \Cle{clés} sont disponibles pour cette commande : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \begin{tikzpicture} \BoiteMoustachesAxe[Min=8,Max=21,AffValeurs,Valeurs={8,9,...,21},Elargir=0.02] \BoiteMoustaches[Moyenne=18.5,Couleur=blue]{10/15/17/19/20} \BoiteMoustaches[Elevation=2.5,Couleur=red]{8/10/11/12/15} \BoiteMoustaches[Elevation=4,Couleur=ForestGreen,Remplir=ForestGreen!25]{10/14/14.5/16/21} \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} Le placement des différentes boîtes n'est pas automatique, donc il faut penser à cela avant de se lancer dans le code. @@ -4478,7 +4759,7 @@ De ce fait, les options de \ctex{siunitx} de l'utilisateur affecterons les forma \subsection{Calculs \og simples \fg} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %loi binomiale B(n,p) \CalcBinomP{n}{p}{k} %P(X=k) \CalcBinomC{n}{p}{a}{b} %P(a<=X<=b) @@ -4500,7 +4781,7 @@ De ce fait, les options de \ctex{siunitx} de l'utilisateur affecterons les forma %loi exponentielle E(l) \CalcExpoC{l}{a}{b} %P(a<=X<=b) -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Les probabilités calculables sont donc -- comme pour beaucoup de modèles de calculatrices -- les probabilités \textbf{P}onctuelles ($P(X=k)$) et \textbf{C}umulées ($P(a\leqslant X\leqslant b)$). @@ -4510,7 +4791,7 @@ Les probabilités calculables sont donc -- comme pour beaucoup de modèles de ca Pour les probabilités cumulées, on peut utiliser le caractère \ctex{*} comme borne ($a$ ou $b$), pour les probabilités du type $P(X\leqslant b)$ et $P(X \geqslant a)$. \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} % X -> B(5,0.4) $P(X=3) \approx \CalcBinomP{5}{0.4}{3}$. $P(X\leqslant1) \approx \CalcBinomC{5}{0.4}{*}{1}$. @@ -4530,9 +4811,9 @@ $P(T\leqslant5) \approx \CalcPoissC{0.5}{*}{5}$. % W -> H(50,10,5) $P(W=4) \approx \CalcHypergeomP{50}{10}{5}{4}$. $P(1\leqslant W\leqslant3) \approx \CalcHypergeomC{50}{10}{5}{1}{3}$. -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} $\bullet~~~~X \hookrightarrow \mathcal{B}(5\,; 0,4)$ :\\ $P(X=3) \approx \CalcBinomP{5}{0.4}{3}$.\\ $P(X\leqslant1) \approx \CalcBinomC{5}{0.4}{*}{1}$. @@ -4560,9 +4841,9 @@ $P(T\leqslant5) \approx \CalcGeomC{0.5}{*}{5}$. $\bullet~~~~W \hookrightarrow \mathcal{H}(50\,; 10\,; 5)$ :\\ $P(W=4) \approx \CalcHypergeomP{50}{10}{5}{4}$.\\ $P(1\leqslant W\leqslant3) \approx \CalcHypergeomC{50}{10}{5}{1}{3}$. -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} % X -> N(0,1) $P(X\leqslant1) \approx \CalcNormC{0}{1}{*}{1}$. $P(-1,96\leqslant Z\leqslant1,96) \approx \CalcNormC{0}{1}{-1.96}{1.96}$. @@ -4574,9 +4855,9 @@ $P(500\leqslant Y\leqslant600) \approx \CalcNormC{550}{30}{500}{600}$. % Z -> E(0.001) $P(Z\geqslant400) \approx \CalcExpoC{0.001}{400}{*}$. $P(300\leqslant Z\leqslant750) \approx \CalcExpoC{0.001}{300}{750}$. -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} $\bullet~~~~X \hookrightarrow \mathcal{N}(0\,; 1)$ :\\ $P(X\leqslant1) \approx \CalcNormC{0}{1}{*}{1}$.\\ $P(-1,96\leqslant Z\leqslant1,96) \approx \CalcNormC{0}{1}{-1.96}{1.96}$. @@ -4592,7 +4873,7 @@ $P(500\leqslant Y\leqslant600) \approx \CalcNormC{550}{30}{500}{600}$. $\bullet~~~~Z \hookrightarrow \mathcal{E}_{0,001}$ :\\ $P(Z\geqslant400) \approx \CalcExpoC{0.001}{400}{*}$.\\ $P(300\leqslant Z\leqslant750) \approx \CalcExpoC{0.001}{300}{750}$. -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Complément avec sortie \og formatée \fg} @@ -4604,16 +4885,16 @@ L'idée est ensuite de formater le résultat obtenu par \ctex{xintexpr}, pour un L'utilisateur peut donc utiliser \og sa \fg{} méthode pour formater les résultats obtenus par \ctex{xintexpr} ! \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %avec un formatage manuel \num[exponent-mode=scientific]{\CalcBinomP{100}{0.02}{10}} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\bullet~~~~X \hookrightarrow \mathcal{B}(100\,; 0,02)$ : $P(X=10) \approx \num[exponent-mode=scientific]{\CalcBinomP{100}{0.02}{10}}$. -\end{PresentationCodePL} +\end{PresCodePL} \begin{tipblock} Le package \ctex{ProfLycee} propose -- en complément -- des commandes pour formater, grâce à \ctex{siunitx}, le résultat. @@ -4627,7 +4908,7 @@ Les commandes ne sont donc, dans ce cas, pas préfixées par \ctex{calc} : \vspace*{-\baselineskip}\leavevmode \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %loi binomiale B(n,p) \BinomP(*)[prec]{n}{p}{k} %P(X=k) \BinomC(*)[prec]{n}{p}{a}{b} %P(a<=X<=b) @@ -4649,7 +4930,7 @@ Les commandes ne sont donc, dans ce cas, pas préfixées par \ctex{calc} : %loi exponentielle E(l) \ExpoC(*)[prec]{l}{a}{b} %P(a<=X<=b) -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Quelques précisions sur les commandes précédentes : @@ -4661,7 +4942,7 @@ Quelques précisions sur les commandes précédentes : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} % X -> N(550,30) $P(Y\geqslant600) \approx \NormaleC[4]{550}{30}{600}{*}$. $P(500\leqslant Y\leqslant600) \approx \NormaleC[4]{550}{30}{500}{600}$. @@ -4677,9 +4958,9 @@ $P(300\leqslant Z\leqslant750) \approx \ExpoC{0.001}{300}{750}$. % T -> P(5) $P(T=3) \approx \PoissonP{5}{3}$. $P(T\geqslant2) \approx \PoissonC[4]{5}{2}{*}$. -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} $\bullet~~~~Y \hookrightarrow \mathcal{N}(550\,; 30)$ : $P(Y\geqslant600) \approx \NormaleC[4]{550}{30}{600}{*}$. @@ -4717,7 +4998,7 @@ $\bullet~~~~T \hookrightarrow \mathcal{P}_5$ : $P(T=3) \approx \PoissonP{5}{3}$. $P(T\geqslant2) \approx \PoissonC[4]{5}{2}{*}$. -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{noteblock} \hfill~\includegraphics[height=3cm]{./graphics/pl-doc-probas_a}~~\includegraphics[height=3cm]{./graphics/pl-doc-probas_c}~~\includegraphics[height=3cm]{./graphics/pl-doc-probas_e}~~\includegraphics[height=3cm]{./graphics/pl-doc-probas_f}\hfill~ @@ -4740,7 +5021,7 @@ L'idée est de proposer des commandes pour créer des arbres de probabilités cl Les (deux) commandes sont donc liées à un environnement \ctex{tikzpicture}, et elles créent les nœuds de l'arbre, pour exploitation ultérieure éventuelle. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %commande simple pour tracé de l'arbre \ArbreProbasTikz[options]{donnees} @@ -4748,7 +5029,7 @@ Les (deux) commandes sont donc liées à un environnement \ctex{tikzpicture}, et \begin{EnvArbreProbasTikz}[options]{donnees} code tikz supplémentaire \end{EnvArbreProbasTikz} -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Options et arguments} @@ -4784,7 +5065,7 @@ Quelques \Cle{Clés} (communes) pour les deux commandes : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \def\ArbreDeuxDeux{ $A$/\num{0.5}/, $B$/\num{0.4}/, @@ -4797,9 +5078,9 @@ Quelques \Cle{Clés} (communes) pour les deux commandes : \ArbreProbasTikz{\ArbreDeuxDeux} %des éléménts, en gris, ont été rajoutés pour illustrer certaines options -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{EnvArbreProbasTikz}{$A$/\num{0.5}/,$B$/\num{0.4}/,$\overline{B}$/.../,$\overline{A}$/.../,$B$/.../,$\overline{B}$/$\frac{1}{3}$/} \draw[lightgray] (R) node[left,font=\ttfamily\small] {(R)} ; \draw[lightgray] (A11) node[below,font=\ttfamily\small] {(A11)} ; @@ -4814,7 +5095,7 @@ Quelques \Cle{Clés} (communes) pour les deux commandes : \draw[lightgray,<->,>=latex] (7,-1) -- (7,-2) node[midway,right,font=\ttfamily\small] {EspaceFeuille} ; \draw[lightgray,<->,>=latex] (7,-2) -- (7,-3) node[midway,right,font=\ttfamily\small] {EspaceFeuille} ; \end{EnvArbreProbasTikz} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{noteblock} Les nœuds crées par les commandes sont : @@ -4829,7 +5110,7 @@ Les nœuds crées par les commandes sont : \subsection{Exemples complémentaires} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \def\ArbreTroisDeux{ $A_1$/\num{0.5}/above, $B$/\num{0.4}/above, @@ -4846,15 +5127,15 @@ Les nœuds crées par les commandes sont : {\ArbreTroisDeux} \draw[ForestGreen,->] (A24)--($(A24)+(2.5,0)$) node[right,font=\sffamily] {code tikz rajouté} ; \end{EnvArbreProbasTikz} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \begin{EnvArbreProbasTikz}[Type=3x2,Fleche,EspaceNiveau=5,EspaceFeuille=1.25]{$A_1$/\num{0.5}/above,$B$/\num{0.4}/above,$\overline{B}$/.../below,$A_2$/.../above,$B$/.../above,$\overline{B}$/$\frac{1}{3}$/below,$A_3$/.../below,$B$/.../above,$\overline{B}$/$\frac{4}{15}$/below} \draw[ForestGreen,->] (A24)--($(A24)+(2.5,0)$) node[right,font=\sffamily] {code tikz rajouté} ; \end{EnvArbreProbasTikz} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \def\ArbreDeuxTrois{ $A$/\num{0.05}/above, $B_1$/\num{0.4}/above,$B_2$/\num{0.35}/,$B_3$//below, @@ -4870,13 +5151,13 @@ Les nœuds crées par les commandes sont : } \ArbreProbasTikz[Type=3x3,StyleTrait={densely dashed},EspaceFeuille=0.7,PoliceProbas=\scriptsize,Police=\small]{\ArbreTroisTrois} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \ArbreProbasTikz[Type=2x3,InclineProbas=false,EspaceFeuille=1.15]{$A$/\num{0.05}/above,$B_1$/\num{0.4}/above,$B_2$/\num{0.35}/,$B_3$//below,$\overline{A}$/.../below,$B_1$/$\frac{2}{15}$/above,$B_2$/.../,$B_3$/$\frac{1}{3}$/below} ~~ \ArbreProbasTikz[Type=3x3,StyleTrait={densely dashed},EspaceFeuille=0.7,PoliceProbas=\scriptsize,Police=\small]{$A_1$/\num{0.05}/,$B_1$/{1/3}/,$B_2$/{1/3}/,$B_3$/{1/3}/,$A_2$/\num{0.80}/,$B_1$/{1/3}/,$B_2$/{1/3}/,$B_3$/{1/3}/,$A_3$/\num{0.15}/,$B_1$/{1/3}/,$B_2$/{1/3}/,$B_3$/{1/3}/} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -4892,15 +5173,15 @@ L'idée est de proposer des commandes pour illustrer, sous forme de schémas en Ces \og schémas \fg{} peuvent être insérés en tant que graphique explicatif, ou bien en tant que petite illustration rapide ! \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \LoiNormaleGraphe[options] {m}{s}{a}{b} \LoiExpoGraphe[options] {l}{a}{b} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \hfill\LoiNormaleGraphe{100}{20}{80}{120}\hspace{3cm}\LoiExpoGraphe{0.001}{250}{1500}\hfill~ -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{cautionblock} Les probabilités \textit{illustrables} sont donc des probabilités \textbf{C}umulées ($P(a\leqslant X\leqslant b)$). @@ -4930,14 +5211,14 @@ Quelques \Cle{Clés} sont disponibles pour ces commandes : Les commandes sont donc des environnements \TikZ, sans possibilité de \og rajouter \fg{} des éléments. Ces petis \textit{schémas} sont donc vraiment dédiés à \textit{montrer} rapidement une probabilité continue, sans fioriture. \end{noteblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} Avec centrage vertical sur l'axe des abscisses : \LoiNormaleGraphe [AfficheM=false,CouleurCourbe=Blue,CouleurAire=LightBlue] % {1000}{100}{950}{*} -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} Avec quelques modifications : \LoiNormaleGraphe[Largeur=4,Hauteur=2]{150}{12.5}{122}{160} @@ -4956,7 +5237,7 @@ Avec centrage vertical sur l'axe des abscisses : \medskip \LoiExpoGraphe[Largeur=4,Hauteur=2]{0.00025}{5000}{*} -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Remarques et compléments} @@ -4984,7 +5265,7 @@ Pour le moment, seules les lois (continues) exponentielles et normales sont disp Pour chacune des commandes, le ou les résultats sont stockés dans une \textsf{macro} dont le nom est choisi par l'utilisateur. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %entier aléatoire entre a et b \NbAlea{a}{b}{macro} @@ -4996,9 +5277,9 @@ Pour chacune des commandes, le ou les résultats sont stockés dans une \textsf{ %liste d'entiers aléatoires \TirageAleatoireEntiers[options]{macro} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} %nombre aléatoire entre 1 et 50, stocké dans \PremierNbAlea Entier entre 1 et 50 : \NbAlea{1}{50}{\PremierNbAlea}\PremierNbAlea \\ %nombre aléatoire créé à partir du 1er, stocké dans \DeuxiemeNbAlea @@ -5007,17 +5288,17 @@ Entier à partir du précédent : \VarNbAlea{\DeuxiemeNbAlea}{\PremierNbAlea+ran Décimal entre 0 et $10,999\ldots$ : \NbAlea[3]{0}{10}{\PremierDecAlea}\PremierDecAlea \\ %liste de 6 nombres, sans répétitions, entre 1 et 50 Liste par défaut (6 entre 1 et 50) : \TirageAleatoireEntiers{\PremiereListeAlea}\PremiereListeAlea -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} Les listes créées sont exploitables, \textit{a posteriori}, par le package \ctex{listofitems} par exemple ! \end{noteblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} Liste générée : \TirageAleatoireEntiers{\TestListeA}\TestListeA Liste traitée : \readlist*\LISTEa{\TestListeA}\showitems{\LISTEa} -\end{PresentationCodePL} +\end{PresCodePL} \pagebreak @@ -5038,7 +5319,7 @@ Quelques clés sont disponibles pour la commande \ctex{TirageAleatoireEntiers} : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} Une liste de 15 valeurs (différentes), entre 10 et 100, stockée dans la macro MaListeA : \\ Liste : \TirageAleatoireEntiers[ValMin=10,ValMax=100,NbVal=15]{\MaListeA}\MaListeA \\ @@ -5051,16 +5332,16 @@ Liste : \TirageAleatoireEntiers[ValMin=1,ValMax=50,NbVal=12,Tri=decroissant]% {\MaListeC}\MaListeC \\ 15 tirages de dé à 6 faces : \\ \TirageAleatoireEntiers[ValMin=1,ValMax=6,NbVal=15,Repetition]{\TestDes}\TestDes -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} Une liste (10) pour le Keno\textcopyright, ordonnée, et séparée par des \texttt{-} : \TirageAleatoireEntiers[ValMin=1,ValMax=70,NbVal=10,Tri=croissant,Sep={-}]{\ListeKeno} $\ListeKeno$ \setsepchar{-}\readlist*\KENO{\ListeKeno}\showitems{\KENO} -\end{PresentationCodePL} +\end{PresCodePL} \newpage @@ -5072,11 +5353,11 @@ $\ListeKeno$ L'idée est de proposer une commande pour calculer un arrangement ou une combinaison, en utilisant les capacités de calcul du package \ctex{xint} (\cmaj{2.5.4}). \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \Arrangement(*)[option]{p}{n} \Combinaison(*)[option]{p}{n} \CalculAnp{p}{n} ou \CalculCnp{p}{n} dans un calcul via \xinteval{...} -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Utilisation} @@ -5086,31 +5367,34 @@ Peu de paramétrage pour ces commandes qui permettent de calculer $A_n^p$ et $\b \begin{itemize} \item les versions étoilées ne formatent pas le résultat grâce à \ctex{\textbackslash num} de \ctex{sinuitx} ; \item le booléen \Cle{Notation} pour avoir la notation au début ; \hfill~défaut \Cle{false} - \item le booléen \Cle{Formule} permet de présenter la formule avant le résultat ; \hfill~défaut \Cle{false} + \item le booléen \Cle{NotationAncien} pour avoir la notation \og ancienne \fg{} des combinaisons au début ; \hfill~défaut \Cle{false} + \item le booléen \Cle{Formule} permet de présenter la formule avant le résultat ; + + \hfill~défaut \Cle{false} \item le premier argument, \textit{obligatoire}, est la valeur de $p$ ; \item le second argument, \textit{obligatoire}, est la valeur de $n$. \end{itemize} \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} On a $A_{20}^3=\Arrangement*{3}{20}$ en non formaté, et $\Arrangement[Notation]{3}{20}$ en formaté avec la notation au début. -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} On a $\displaystyle\binom{20}{3}=\Combinaison*{3}{20}$ en non formaté,~ et $\displaystyle\Combinaison[Notation]{3}{20}$ en formaté avec la notation au début.\\ Et $\dbinom{20}{3}+\dbinom{20}{4} = \num{\xinteval{\CalculCnp{3}{20}+\CalculCnp{4}{20}}}$. -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} On a $\displaystyle\Arrangement[Notation,Formule]{3}{20}$. -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} On a $\displaystyle\Combinaison[NotationAncien,Formule]{3}{20}$. %ancienne notation FR -\end{PresentationCodePL} +\end{PresCodePL} \newpage @@ -5148,7 +5432,7 @@ Le package \ctex{xintbinhex} est la base de ces macros, puisqu'il permet de fair Les macros présentées ici ne font que les intégrer dans un environnement adapté à une correction ou une présentation ! \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \xintDecToHex{100} \xintDecToBin{51} \xintHexToDec{A4C} @@ -5156,9 +5440,9 @@ Les macros présentées ici ne font que les intégrer dans un environnement adap \xintBinToHex{11111111} \xintHexToBin{ACDC} \xintCHexToBin{3F} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \xintDecToHex{100} \xintDecToBin{51} @@ -5172,13 +5456,13 @@ Les macros présentées ici ne font que les intégrer dans un environnement adap \xintHexToBin{ACDC} \xintCHexToBin{3F} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Conversion décimal vers binaire} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \ConversionDecBin(*)[clés]{nombre} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Concernant la commande en elle même, peu de paramétrage : @@ -5196,7 +5480,7 @@ Le formatage est géré par \ctex{sinuitx}, le mieux est donc de positionner la Les nombres écrits en binaire sont, par défaut, présentés en bloc(s) de 4 chiffres. \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} % Conversion avec affichage de la base et par bloc de 4 $\ConversionDecBin{415}$ % Conversion avec affichage de la base et sans forcément des blocs de 4 @@ -5205,9 +5489,9 @@ $\ConversionDecBin*{415}$ $\ConversionDecBin[AffBase=false]{415}$ % Conversion sans affichage de la base et sans forcément des blocs de 4 $\ConversionDecBin*[AffBase=false]{415}$ -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} $\ConversionDecBin{415}$ \smallskip @@ -5221,7 +5505,7 @@ $\ConversionDecBin[AffBase=false]{415}$ \smallskip $\ConversionDecBin*[AffBase=false]{415}$ -\end{PresentationCodePL} +\end{PresCodeSortiePL} \subsection{Conversion binaire vers hexadécimal} @@ -5237,9 +5521,9 @@ L'idée est ici de présenter la conversion, grâce à la conversion \og directe \vspace*{-\baselineskip}\leavevmode \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \ConversionBinHex[clés]{nombre} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Quelques \Cle{clés} sont disponibles pour cette commande : @@ -5253,22 +5537,22 @@ Quelques \Cle{clés} sont disponibles pour cette commande : Le formatage est géré par le package \ctex{sinuitx}, le mieux est de positionner la commande dans un environnement mathématique. \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %conversion avec détails et affichage de la base $\ConversionBinHex{110011111}$ %conversion sans détails et affichage de la base $\ConversionBinHex[Details=false]{110011111}$ %conversion sans détails et sans affichage de la base $\ConversionBinHex[AffBase=false,Details=false]{110011111}$ -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} $\ConversionBinHex{110011111}$ $\ConversionBinHex[Details=false]{110011111}$ $\ConversionBinHex[AffBase=false,Details=false]{110011111}$ -\end{PresentationCodePL} +\end{PresCodeSortiePL} \pagebreak @@ -5285,9 +5569,9 @@ L'idée est ici de présenter la conversion, grâce à l'écriture polynômiale \vspace*{-\baselineskip}\leavevmode \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \ConversionVersDec[clés]{nombre} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Quelques \Cle{clés} sont disponibles pour cette commande : @@ -5302,7 +5586,7 @@ Quelques \Cle{clés} sont disponibles pour cette commande : Le formatage est toujours géré par le package \ctex{sinuitx}, le mieux est de positionner la commande dans un environnement mathématique. \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %conversion 16->10 avec détails et affichage de la base et zéros $\ConversionVersDec[BaseDep=16]{19F}$ %conversion 2->10 avec détails et affichage de la base et zéros @@ -5313,9 +5597,9 @@ $\ConversionVersDec[Zeros=false]{110011}$ $\ConversionVersDec[BaseDep=16,Details=false]{AC0DC}$ %conversion 16->10 avec détails et sans affichage de la base et sans zéros $\ConversionVersDec[Eeros=false,Basedep=16]{AC0DC}$ -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} $\ConversionVersDec[BaseDep=16]{19F}$ $\ConversionVersDec{110011}$ @@ -5325,7 +5609,7 @@ $\ConversionVersDec[Zeros=false]{110011}$ $\ConversionVersDec[BaseDep=16,Details=false]{AC0DC}$ $\ConversionVersDec[Zeros=false,BaseDep=16]{AC0DC}$ -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -5345,26 +5629,26 @@ Les commandes de la section précédente donne \textit{juste} les résultats, da La commande utilise -- par défaut -- du code \TikZ{} en mode \ctex{overlay}, donc on pourra déclarer -- si ce n'est pas fait -- dans le préambule, la commande qui suit. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} ... \tikzstyle{every picture}+=[remember picture] ... -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Code et clés} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} %conversion basique \ConversionDepuisBaseDix{78}{2} -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} La \og tableau \fg, qui est géré par \ctex{array} est inséré dans un \ctex{ensuremath}, donc les \ctex{\$...\$} ne sont pas utiles. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \ConversionDepuisBaseDix[options]{nombre en base 10}{base d'arrivée} -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{cautionblock} Quelques options pour cette commande : @@ -5384,7 +5668,7 @@ Quelques options pour cette commande : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %conversion avec changement de couleur \ConversionDepuisBaseDix[Couleur=DarkBlue]{45}{2} @@ -5399,9 +5683,9 @@ Par divisions euclidiennes successives, \ConversionDepuisBaseDix[Rect=false]{54} \begin{tikzpicture} \draw[overlay,ForestGreen,thick,->] (TEST2.south east) to[bend right] ++ (3cm,-1cm) node[right] {test } ; \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \ConversionDepuisBaseDix[Couleur=DarkBlue]{45}{2} \medskip @@ -5422,7 +5706,7 @@ On obtient donc \ConversionDepuisBaseDix[Couleur=ForestGreen,CouleurRes,Noeud=TE \vspace{1.5cm} ~ -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -5436,19 +5720,19 @@ L'idée est de proposer une \og présentation \fg{} de l'algorithme d'Euclide po Le package \ctex{xintgcd} permet déjà de le faire, il s'agit ici de travailler sur la \textit{mise en forme}. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \PresentationPGCD[options]{a}{b} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \tikzstyle{every picture}+=[remember picture] ... \PresentationPGCD{150}{27} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \PresentationPGCD{150}{27} -\end{PresentationCodePL} +\end{PresCodePL} \begin{warningblock} La mise en valeur du dernier reste non nul est géré par du code \TikZ, en mode \ctex{overlay}, donc il faut bien penser à déclarer dans le préambule : \ctex{\textbackslash{}tikzstyle\{every picture\}+=[remember picture]} @@ -5484,13 +5768,13 @@ Le rectangle de mise en valeur est donc un nœud \TikZ{} qui sera nommé, par d La présentation est dans un environnement \ctex{ensuremath} donc les \ctex{\$...\$} ne sont pas indispensables. \end{cautionblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \PresentationPGCD[CouleurResultat]{150}{27} -\end{PresentationCodePL} +\end{PresCodePL} \pagebreak -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \PresentationPGCD[CouleurResultat,Couleur=ForestGreen]{1250}{450}. \PresentationPGCD[CouleurResultat,Couleur=DarkBlue]{13500}{2500}. @@ -5502,7 +5786,7 @@ D'après l'algorithme d'Euclide, on a $\left| \PresentationPGCD[Couleur=LightSky \begin{tikzpicture} \draw[overlay,LightSkyBlue,thick,<-] (FFF1.east) to[bend right] ++ (1cm,0.75cm) node[right] {dernier reste non nul} ; \end{tikzpicture} -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Compléments} @@ -5512,9 +5796,9 @@ La présentation des divisions euclidiennes est gérée par un tableau du type \ Par défaut, les délimiteurs choisis sont donc l'accolade gauche et le trait droit, mais la clé booléenne \Cle{AfficheDelimiteurs=false} permet de choisir des délimiteurs différents. \end{noteblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\left[ \PresentationPGCD[AfficheConclusion=false,AfficheDelimiteurs=false]{1234}{5} \right]$ -\end{PresentationCodePL} +\end{PresCodePL} \newpage @@ -5538,9 +5822,9 @@ $\left[ \PresentationPGCD[AfficheConclusion=false,AfficheDelimiteurs=false]{1234 L'idée est d'obtenir une commande pour \textit{simplifier} un calcul sous forme de fraction irréductible. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \ConversionFraction(*)[option de formatage]{calcul} -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Commande et options} @@ -5563,7 +5847,7 @@ Quelques explications sur cette commande : À noter que la macro est dans un bloc \ctex{ensuremath} donc les \ctex{\$...\$} ne sont pas nécessaires. \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \ConversionFraction{-10+1/3*(-5/16)} %sortie par défaut \ConversionFraction*{-10+1/3*(-5/16)} %sortie fraction avec - sur numérateur \ConversionFraction[d]{-10+1/3*(-5/16)} %sortie en displaystyle @@ -5572,9 +5856,9 @@ Quelques explications sur cette commande : \ConversionFraction{2+91/7} %entier formaté \ConversionFraction{111/2145} \ConversionFraction{111/3} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \ConversionFraction{-10+1/3*(-5/16)} \smallskip @@ -5604,9 +5888,9 @@ Quelques explications sur cette commande : \smallskip \ConversionFraction{111/3} -\end{PresentationCodePL} +\end{PresCodeSortiePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\frac{111}{2145}=\ConversionFraction{111/2145}$ \\ $\frac{3}{15}=\ConversionFraction[]{3/15}$ \\ @@ -5624,7 +5908,7 @@ $\dfrac{1}{7}-\dfrac{3}{8}=\ConversionFraction[d]{1/7-3/8}$ \\ $\ConversionFraction[d]{1+1/2}$ \\ $\ConversionFraction{0.1/0.7+30/80}$ -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} A priori le package \ctex{xint} permet de s'en sortir pour des calculs \og simples \fg, je ne garantis pas que tout calcul ou toute division donne un résultat \textit{satisfaisant} ! @@ -5642,9 +5926,9 @@ L'idée est d'obtenir une commande pour simplifier l'écriture d'un ensemble d' Les délimiteurs de l'ensemble créé sont toujours \textsf{\{~~\}}. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \EcritureEnsemble[clés]{liste} -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Commande et options} @@ -5665,15 +5949,15 @@ Peu d'options pour ces commandes : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} $\EcritureEnsemble{a/b/c/d/e}$ $\EcritureEnsemble[Mathpunct=false]{a/b/c/d/e}$ $\EcritureEnsemble[Sep={,}]{a/b/c/d/e}$ $\EcritureEnsemble[Option={\strut}]{a/b/c/d/e}$ % \strut pour "augmenter" un peu la hauteur des {} $\EcritureEnsemble{ \frac{1}{1+\frac{1}{3}} / b / c / d / \frac{1}{2} }$ -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} $\EcritureEnsemble{a/b/c/d/e}$ \smallskip @@ -5691,7 +5975,7 @@ $\EcritureEnsemble[Option={\strut}]{a/b/c/d/e}$ \smallskip $\EcritureEnsemble{ \displaystyle\frac{1}{1+\frac{1}{3}} / b / c / d / \displaystyle\frac{1}{2} }$ -\end{PresentationCodePL} +\end{PresCodeSortiePL} \begin{noteblock} Attention cependant au comportement de la commande avec des éléments en mode \textsf{mathématique}, ceux-ci peuvent générer une erreur si \textsf{displaystyle} n'est pas utilisé\ldots @@ -5715,16 +5999,16 @@ En combinant avec le package \ctex{xfp} et fonction de générateur d'entiers al L'affichage des monômes est géré par le package \ctex{siunitx} et le tout est dans un environnement \ctex{ensuremath}. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \EcritureTrinome[options]{a}{b}{c} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \EcritureTrinome{1}{7}{0}\\ \EcritureTrinome{1.5}{7.3}{2.56}\\ \EcritureTrinome{-1}{0}{12}\\ \EcritureTrinome{-1}{-5}{0} -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Clés et options} @@ -5742,7 +6026,7 @@ Quelques clés et options sont disponibles : La clé \Cle{Alea} va modifier la manière de saisir les coefficients, il suffira dans ce cas de préciser les bornes, sous la forme \ctex{valmin,valmax}, de chacun des coefficients. C'est ensuite le package \ctex{xfp} qui va se charger de générer les coefficients. \end{noteblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} Avec $a$ entre 1 et 5 (et signe aléatoire) puis $b$ entre $-2$ et 7 puis $c$ entre $-10$ et 20 : \\ $f(x)=\EcritureTrinome[Alea]{1,5}{-5,5}{-10,10}$\\ $g(x)=\EcritureTrinome[Alea]{1,5}{-5,5}{-10,10}$\\ @@ -5751,7 +6035,7 @@ Avec $a$ entre 1 et 10 (forcément positif) puis $b$ entre $-2$ et 2 puis $c$ en \EcritureTrinome[Alea,Anegatif=false]{1,10}{-2,2}{0,4}\\ \EcritureTrinome[Alea,Anegatif=false]{1,10}{-2,2}{0,4}\\ \EcritureTrinome[Alea,Anegatif=false]{1,10}{-2,2}{0,4} -\end{PresentationCodePL} +\end{PresCodePL} \newpage @@ -5763,14 +6047,14 @@ Avec $a$ entre 1 et 10 (forcément positif) puis $b$ entre $-2$ et 2 puis $c$ en \cmaj{2.1.0} L'idée est de proposer une commande pour simplifier \textit{automatiquement} une racine carrée, sous la forme $\frac{a\sqrt{b}}{c}$ avec $\frac{a}{c}$ irréductible et $b$ le \frquote{plus petit possible}. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \SimplificationRacine{expression ou calcul} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \SimplificationRacine{48} \\ \SimplificationRacine{100/34}\\ \SimplificationRacine{99999} \\ \SimplificationRacine{1500*0.31*(1-0.31)}\\ -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} C'est -- comme souvent -- le package \ctex{xint} qui s'occupe en interne des calculs, et qui devrait donner des résultats satisfaisants dans la majorité des cas (attention aux \textit{grands nombres}\ldots) @@ -5782,7 +6066,7 @@ La commande ne fait pas office de \textit{calculatrice}, elle ne permet \textit{ \subsection{Exemples} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} %Simplification d'un module de complexe $\left| 4+6\text{i}\right| = \sqrt{4^2+6^2} = \sqrt{\xinteval{4**2+6**2}}=\SimplificationRacine{4**2+6**2}$ @@ -5794,7 +6078,7 @@ $\frac{42}{\sqrt{5}}=\left(\sqrt{\frac{42^2}{5}}\right)=\SimplificationRacine{(4 %Écart-type d'une loi binomiale $\sqrt{\num{150}\times\num{0.35}\times(1-\num{0.35})} = \displaystyle\SimplificationRacine{150*0.35*(1-0.35)}$ -\end{PresentationCodePL} +\end{PresCodePL} \newpage @@ -5806,9 +6090,9 @@ $\sqrt{\num{150}\times\num{0.35}\times(1-\num{0.35})} = \displaystyle\Simplifica \cmaj{2.1.2} L'idée est de proposer (sur une suggestion de Marylyne Vignal) une commande pour déterminer la mesure principale d'un angle en radian. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \MesurePrincipale[booléens]{angle} %dans un mode mathématique -\end{PresentationCodePL} +\end{PresCodeTexPL} \begin{noteblock} La commande est à insérer dans un environnement mathématique, via \ctex{\$...\$} ou \ctex{\textbackslash[...\textbackslash]}. @@ -5832,7 +6116,7 @@ Pour cette commande : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} $\MesurePrincipale[d]{54pi/7}$ $\MesurePrincipale[d]{-128pi/15}$ $\MesurePrincipale{3pi/2}$ @@ -5842,9 +6126,9 @@ $\MesurePrincipale{28pi}$ $\MesurePrincipale[d]{14pi/4}$ $\MesurePrincipale[Crochets]{14pi/7}$ $\dfrac{121\pi}{12} = \MesurePrincipale[Brut]{121pi/12}$ à $2\pi$ près -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} $\MesurePrincipale[d]{54pi/7}$ \medskip @@ -5878,7 +6162,7 @@ $\MesurePrincipale[Crochets]{14pi/7}$ \medskip $\dfrac{121\pi}{12} = \MesurePrincipale[d,Brut]{121pi/12}$ à $2\pi$ près -\end{PresentationCodePL} +\end{PresCodeSortiePL} \pagebreak @@ -5894,9 +6178,9 @@ $\dfrac{121\pi}{12} = \MesurePrincipale[d,Brut]{121pi/12}$ à $2\pi$ près La commande détermine -- et affiche si demandée la réduction -- et la valeur exacte de la ligne trigonométrique demandée. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} \LigneTrigo(*)[booléens]{cos/sin/tan}(angle) -\end{PresentationCodePL} +\end{PresCodeTexPL} \subsection{Commande} @@ -5913,47 +6197,47 @@ Pour cette commande : \vspace*{-\baselineskip}\leavevmode \end{cautionblock} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\LigneTrigo{cos}(56pi/3)$ et $\LigneTrigo{sin}(56pi/3)$ et $\LigneTrigo{tan}(56pi/3)$ -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\LigneTrigo[d,Etapes]{cos}(56pi/3)$ et $\LigneTrigo[d,Etapes]{sin}(56pi/3)$ -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\LigneTrigo*[d,Etapes]{cos}(2pi/3)$ et $\LigneTrigo*[d,Etapes]{sin}(2pi/3)$ -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\LigneTrigo[d,Etapes]{cos}(146pi)$ et $\LigneTrigo[d,Etapes]{sin}(146pi)$ -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\LigneTrigo[d,Etapes]{cos}(-551pi/12)$ et $\LigneTrigo[d,Etapes]{sin}(-551pi/12)$ -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\LigneTrigo[d,Etapes]{cos}(447pi/8)$ et $\LigneTrigo[d,Etapes]{sin}(447pi/8)$ -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\LigneTrigo*[d,Etapes]{cos}(-pi/8)$ et $\LigneTrigo*[d,Etapes]{sin}(-pi/8)$ -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\LigneTrigo[d,Etapes]{cos}(-595pi/12)$ et $\LigneTrigo[d,Etapes]{sin}(-595pi/12)$ et $\LigneTrigo[d,Etapes]{tan}(-595pi/12)$ -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\LigneTrigo[d,Etapes]{cos}(33pi/10)$ et $\LigneTrigo[d,Etapes]{sin}(33pi/10)$\\ $\LigneTrigo[d,Etapes]{tan}(33pi/10)$ -\end{PresentationCodePL} +\end{PresCodePL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} $\LigneTrigo[d,Etapes]{cos}(-14pi/5)$ et $\LigneTrigo[d,Etapes]{sin}(-14pi/5)$\\ $\LigneTrigo[d,Etapes]{tan}(-14pi/5)$ -\end{PresentationCodePL} +\end{PresCodePL} \subsection{Valeurs disponibles} @@ -6037,14 +6321,14 @@ L'idée est de \textit{proposer} un environnement \TikZ, une commande permettant L'environnement créé, lié à \TikZ, trace la grille de SudoMaths (avec les blocs démarqués), et peut la remplir avec une liste d'éléments. \end{tipblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %grille classique non remplie, avec légendes H/V, {} nécessaires pour préciser que les cases seront "vides" \SudoMaths{} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{} +\begin{PresCodePL}{} \SudoMaths{} -\end{PresentationCodePL} +\end{PresCodePL} \begin{noteblock} La commande \ctex{SudoMaths} crée donc la grille (remplie ou non), dans un environnement \TikZ, c'est \textit{c'est tout} ! @@ -6054,7 +6338,7 @@ La commande \ctex{SudoMaths} crée donc la grille (remplie ou non), dans un envi On peut également utiliser l'\textit{environnement} \ctex{EnvSudoMaths} dans lequel on peut rajouter du code \TikZ{} ! \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %grille "toute seule" \SudoMaths[clés]{liste} @@ -6062,7 +6346,7 @@ On peut également utiliser l'\textit{environnement} \ctex{EnvSudoMaths} dans le \begin{EnvSudoMaths}[clés]{grille} %commandes tikz \end{EnvSudoMaths} -\end{PresentationCodePL} +\end{PresCodeTexPL} \pagebreak @@ -6103,7 +6387,7 @@ Il peut donc être intéressant de \textit{déclarer} la liste au préalable pou La \Cle{CouleurCase} est gérée -- en interne -- par le caractère \ctex{*} qui permet de préciser qu'on veut que la case soit coloriée. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %grille 6x6 avec blocs 2x3, avec coloration de cases (présentée sous forme de "cases") \def\grilleSuMa{% (a)* / (b)* / / / (c)* / (d)* §% @@ -6117,9 +6401,9 @@ La \Cle{CouleurCase} est gérée -- en interne -- par le caractère \ctex{*} qui \SudoMaths[Unite=0.75cm,NbCol=6,NbSubCol=2,NbLig=6,NbSubLig=3,% Police=\small\bfseries\ttfamily,CouleurTexte=red,CouleurCase=yellow!50,% Legendes=false]{\grilleSuMa} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \def\grilleSuMa{% (a)* / (b)* / / / (c)* / (d)* §% (e)* / / / (f)* / (g)* / (h)* §% @@ -6131,15 +6415,15 @@ La \Cle{CouleurCase} est gérée -- en interne -- par le caractère \ctex{*} qui \SudoMaths[Unite=0.75cm,NbCol=6,NbSubCol=2,NbLig=6,NbSubLig=3,Police=\small\bfseries\ttfamily,CouleurTexte=red,CouleurCase=yellow!50,% Legendes=false]{\grilleSuMa} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \pagebreak \begin{noteblock} -La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0\,;\,0)$ et $(\text{nbcol}\,;\,-\text{nblig})$, de sorte que les labels des cases sont situés au nœuds de coordonnées $(x,5\,;\,-y,5)$. +La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0;0)$ et $(\text{nbcol};-\text{nblig})$, de sorte que les labels des cases sont situés au nœuds de coordonnées $(x,5;-y,5)$. \end{noteblock} -\begin{PresentationCodePL}{listing only} +\begin{PresCodeTexPL}{listing only} %grille classique avec coloration de cases et commande tikz %graduations rajoutées pour la lecture des coordonnées \def\grilleSuMaB{% @@ -6159,9 +6443,9 @@ La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0 ListeLegV=QSDFGHJKL,ListeLegH=poiuytrez]{\grilleSuMaB} \draw[red,very thick,<-,>=latex] (7.5,-4.5) to[bend right] ++ (4,-1) node[right] {code rajouté...} ; \end{EnvSudoMaths} -\end{PresentationCodePL} +\end{PresCodeTexPL} -\begin{PresentationCodePL}{text only} +\begin{PresCodeSortiePL}{text only} \def\grilleSuMaB{% */////4///§% /*///3////§% @@ -6182,7 +6466,7 @@ La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0 \foreach \y in {-1,-2,...,-9} \draw[lightgray] (9,\y) node[right,font=\scriptsize\ttfamily] {\y} ; \draw[lightgray] (9,0) node[right,font=\scriptsize\ttfamily] {~0} ; \end{EnvSudoMaths} -\end{PresentationCodePL} +\end{PresCodeSortiePL} \newpage @@ -6198,6 +6482,8 @@ La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0 \part{Historique} +{\small \bverb|v 2.6.1|~:~~~~Ajout de commandes pour du calcul intégral (pages \pageref{calcintegr} et \pageref{integrtikz}) + {\small \bverb|v 2.6.0|~:~~~~Ajout d'une clé [Brut] pour les mesures principales + correction d'un bug} + Refonte de la doc {\small \bverb| |~:~~~~Commande calcul ligne trigo (pages \pageref{mesureprincipale} et \pageref{lignestrigo}) diff --git a/macros/latex/contrib/proflycee/doc/graphics/integr_nwks_a.png b/macros/latex/contrib/proflycee/doc/graphics/integr_nwks_a.png new file mode 100644 index 0000000000..be6f4c4fbb Binary files /dev/null and b/macros/latex/contrib/proflycee/doc/graphics/integr_nwks_a.png differ diff --git a/macros/latex/contrib/proflycee/doc/graphics/integr_nwks_b.png b/macros/latex/contrib/proflycee/doc/graphics/integr_nwks_b.png new file mode 100644 index 0000000000..a106d71cf3 Binary files /dev/null and b/macros/latex/contrib/proflycee/doc/graphics/integr_nwks_b.png differ diff --git a/macros/latex/contrib/proflycee/tex/ProfLycee.sty b/macros/latex/contrib/proflycee/tex/ProfLycee.sty index 11c7d596db..6a98a82d75 100644 --- a/macros/latex/contrib/proflycee/tex/ProfLycee.sty +++ b/macros/latex/contrib/proflycee/tex/ProfLycee.sty @@ -3,7 +3,8 @@ % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ProfLycee}[2023/04/13 2.6.0 Aide pour l'utilisation de LaTeX en lycee] +\ProvidesPackage{ProfLycee}[2023/04/27 2.6.1 Aide pour l'utilisation de LaTeX en lycee] +% 2.6.1 Ajout de commandes pour du calcul intégral (valeur approchée + tikz) % 2.6.0 Ajout d'une clé [Brut] pour les mesures principales + commande calcul ligne trigo % Refonte des fichiers inclus + correction de bugs mineurs % Split des thèmes en fichiers 'input' diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-analyse.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-analyse.tex index 921a053556..e1ccba52d6 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-analyse.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-analyse.tex @@ -382,5 +382,153 @@ \expandafter\def\csname#3a\endcsname{\fpeval{round(\varvalm,\DICHOTOstep)}}% } +%==taux acroissement== +\defKV[tauxaccroiss]{% + Precision=\def\TauxAccroisPrec{#1},% + Signe=\def\TauxAccroisEqual{#1},% + NomFct=\def\TauxAccroisFct{#1} +} + +\setKVdefault[tauxaccroiss]{% + Precision=3,% + AffFormule=false,% + Displaystyle=true,% + ResultatBrut=false,% + Signe={\approx},% + NomFct=f +} + +\NewDocumentCommand\TauxAccroissement{ O{} m m m }{%opts+fct+pt+h + \useKVdefault[tauxaccroiss]% + \setKV[tauxaccroiss]{#1}% + \xintdeffloatfunc varfct(x) := #2 ;% + \def\TmpRes{\xintfloateval{(varfct(#3+#4)-varfct(#3))/(#4)}}% + \ifboolKV[methodeintegr]{ResultatBrut}% + {\TmpRes}% + {% + \ifboolKV[tauxaccroiss]{AffFormule}% + {% + \ifboolKV[tauxaccroiss]{Displaystyle}{\displaystyle}{}% + \frac{\TauxAccroisFct(\num{\xinteval{#3+#4}})-\TauxAccroisFct(\num{#3})}{\num{#4}} \TauxAccroisEqual}% + {}% + \num{\xintfloateval{round(\TmpRes,\TauxAccroisPrec)}}% + }% +} + +%==approx intégrale== +\defKV[methodeintegr]{% + Precision=\def\MethIntegrPrec{#1},% + NbSubDiv=\def\MethIntegrNb{#1},% + Methode=\def\MethIntegrType{#1},% + Signe=\def\MethIntegrEqual{#1},% + Expr=\def\MethIntegrFct{#1},% + Variable=\def\MethIntegrVar{#1} +} + +\setKVdefault[methodeintegr]{% + Precision=3,% + NbSubDiv=10,% + Methode=Simpson,% + ResultatBrut=false,% + AffFormule=false,% + Signe={\approx},% + Expr=f(x),% + Variable=x +} + +\NewDocumentCommand\IntegraleApprochee{ O{} m m m }{%opts+fct+a+b + \useKVdefault[methodeintegr]% + \setKV[methodeintegr]{#1}% + \xintdeffloatfunc varfct(x) := #2 ;% + \def\TmpNmU{\xinteval{\MethIntegrNb-1}}% + \IfEq{\MethIntegrType}{RectanglesGauche}% + {% + \def\TmpRes{\xintfloateval{(#4-#3)/\MethIntegrNb*add(varfct(#3+i*(#4-#3)/\MethIntegrNb), i=0..\TmpNmU)}}% + }% + {}% + \IfEq{\MethIntegrType}{RectanglesMilieu}% + {% + \def\TmpRes{\xintfloateval{(#4-#3)/\MethIntegrNb*add(varfct(#3+(i+0.5)*(#4-#3)/\MethIntegrNb), i=0..\TmpNmU)}}% + }% + {}% + \IfEq{\MethIntegrType}{RectanglesDroite}% + {% + \def\TmpRes{\xintfloateval{(#4-#3)/\MethIntegrNb*add(varfct(#3+i*(#4-#3)/\MethIntegrNb), i=1..\MethIntegrNb)}}% + }% + {}% + \IfEq{\MethIntegrType}{Trapezes}% + {% + \def\TmpRes{\xintfloateval{(#4-#3)/\MethIntegrNb*add(0.5*varfct(#3+i*(#4-#3)/\MethIntegrNb)+0.5*varfct(#3+(i+1)*(#4-#3)/\MethIntegrNb), i=0..\TmpNmU)}}% + }% + {}% + \IfEq{\MethIntegrType}{Simpson}% + {% + \def\TmpRes{\xintfloateval{(#4-#3)/(6*\MethIntegrNb)*(2*add(varfct(#3+i*(#4-#3)/\MethIntegrNb), i=1..\TmpNmU)+varfct(#3)+varfct(#4)+4*add(varfct(#3+(i+0.5)*(#4-#3)/\MethIntegrNb), i=0..\TmpNmU))}}% + }% + {}% + \ifboolKV[methodeintegr]{ResultatBrut}% + {\TmpRes}% + {% + \ifboolKV[methodeintegr]{AffFormule}% + {% + \int_{#3}^{#4} \MethIntegrFct\,\text{d}\MethIntegrVar\MethIntegrEqual% + }% + {}% + \num{\xintfloateval{round(\TmpRes,\MethIntegrPrec)}} + }% +} + +%==intégrale tikz== + +\defKV[methodeintegrtkz]{% + Couleur=\def\MethIntegrTkzCol{#1},% + CouleurRemplissage=\def\MethIntegrTkzColOpak{#1},% + NbSubDiv=\def\MethIntegrTkzNb{#1},% + Methode=\def\MethIntegrTkzType{#1},% + Opacite=\def\MethIntegrTkzOpak{#1},% + Epaisseur=\def\MethIntegrTkzThick{#1} +} + +\setKVdefault[methodeintegrtkz]{% + Couleur=red,% + NbSubDiv=10,% + Methode=RectanglesGauche,% + Remplir=true,% + CouleurRemplissage={\MethIntegrTkzCol!25},% + Opacite=0.25,% + Epaisseur=semithick +} + +\NewDocumentCommand\IntegraleApprocheeTikz{ O{} m m m }{%opts+nom_fct+a+b + \useKVdefault[methodeintegrtkz]% + \setKV[methodeintegrtkz]{#1}% + \tikzset{figureintegr/.style={\MethIntegrTkzThick,\MethIntegrTkzCol,fill=\MethIntegrTkzColOpak,fill opacity=\MethIntegrTkzOpak}}% + \def\TmpH{(#4-#3)/\MethIntegrTkzNb} + %rectangles gauches + \IfEq{\MethIntegrTkzType}{RectanglesGauche}% + {% + \foreach \i in {0,...,\inteval{\MethIntegrTkzNb-1}}% + \draw[figureintegr] ({#3+\i*\TmpH},{0}) rectangle++ ({\TmpH},{#2(#3+\i*\TmpH)}) ; + }% + {}% + \IfEq{\MethIntegrTkzType}{RectanglesDroite}% + {% + \foreach \i in {0,...,\inteval{\MethIntegrTkzNb-1}}% + \draw[figureintegr] ({#3+\i*\TmpH},{0}) rectangle++ ({\TmpH},{#2(#3+(\i+1)*\TmpH)}) ; + }% + {}% + \IfEq{\MethIntegrTkzType}{RectanglesMilieu}% + {% + \foreach \i in {0,...,\inteval{\MethIntegrTkzNb-1}}% + \draw[figureintegr] ({#3+\i*\TmpH},{0}) rectangle++ ({\TmpH},{#2(#3+(\i+0.5)*\TmpH)}) ; + }% + {}% + \IfEq{\MethIntegrTkzType}{Trapezes}% + {% + \foreach \i in {0,...,\inteval{\MethIntegrTkzNb-1}}% + \draw[figureintegr] ({#3+\i*\TmpH},{0}) -- ({#3+\i*\TmpH},{#2(#3+\i*\TmpH)}) -- ({#3+(\i+1)*\TmpH},{#2(#3+(\i+1)*\TmpH)}) -- ({#3+(\i+1)*\TmpH},{0}) -- cycle ; + }% + {}% +} \endinput \ No newline at end of file diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-graphiques.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-graphiques.tex index 8f827908ae..0ddb801129 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-graphiques.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-graphiques.tex @@ -520,6 +520,8 @@ {}% } - +\NewDocumentCommand\DeclareFonctionTikz{ O{f} m }{%nom_fonction+langage tikz + \tikzset{declare function={#1(\x)=#2;}} +} \endinput \ No newline at end of file diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex index 0e39796c76..5a098314f7 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex @@ -69,7 +69,7 @@ enhanced,boxrule=1.25pt,% left=0.6em, sharp corners=downhill,arc=12pt, - before skip=\baselineskip,after skip=\baselineskip,% + before skip=0.5\baselineskip,after skip=0.5\baselineskip,% top=\baselineskip,bottom=1mm,right=5mm, attach boxed title to top right={yshift=-\tcboxedtitleheight}, boxed title style={ @@ -114,7 +114,7 @@ \tcbset{StylPythonB/.style={% enhanced,boxrule=0.75pt,colframe=DarkGray!50!Black,% sharp corners,top=0mm,bottom=0mm,left=0.2em,right=5mm,% - before skip=\baselineskip,after skip=\baselineskip,% + before skip=0.5\baselineskip,after skip=0.5\baselineskip,% colback=white, fontupper=\footnotesize,fontlower=\footnotesize,% listing only,listing engine=listings,% @@ -188,7 +188,7 @@ %style tcbox pseudocode avec bannière hautdroite \tcbset{stylepseudocodePL/.style={% enhanced,boxrule=1.25pt,sharp corners=downhill,arc=12pt, - before skip=\baselineskip,after skip=\baselineskip,leftupper=10pt,top=\baselineskip,bottom=1mm,rightupper=5mm,% + before skip=0.5\baselineskip,after skip=0.5\baselineskip,leftupper=10pt,top=\baselineskip,bottom=1mm,rightupper=5mm,% attach boxed title to top right={yshift=-\tcboxedtitleheight}, boxed title style={ size=small,colback=gray!25,boxrule=1.25pt, @@ -267,7 +267,7 @@ \tcbset{stylepseudocodePLalt/.style={% enhanced,boxrule=0.75pt,colframe=DarkGray!50!Black,% sharp corners,top=0mm,bottom=0mm,left=0.4em,right=5mm,% - before skip=\baselineskip,after skip=\baselineskip,% + before skip=0.5\baselineskip,after skip=0.5\baselineskip,% colback=white, fontupper=\footnotesize,fontlower=\footnotesize,% listing only,listing engine=listings,% diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-minted.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-minted.tex index da385ed1a1..4fcf8b8c92 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-minted.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-minted.tex @@ -33,7 +33,7 @@ colframe=Green,colback=ForestGreen!5,% boxrule=1.25pt, sharp corners=downhill,arc=12pt, - before skip=\baselineskip,after skip=\baselineskip,% + before skip=0.5\baselineskip,after skip=0.5\baselineskip,% left=0.6em,top=\baselineskip,bottom=2mm,right=5mm,% attach boxed title to top right={yshift=-\tcboxedtitleheight}, boxed title style={ @@ -74,7 +74,7 @@ width=#2,#3, enhanced,boxrule=0.75pt,colframe=DarkGray!50!Black,% sharp corners,top=0mm,bottom=0mm,left=0.2em,right=5mm,% - before skip=\baselineskip,after skip=\baselineskip,% + before skip=0.5\baselineskip,after skip=0.5\baselineskip,% colback=white, fontupper=\footnotesize,fontlower=\footnotesize,% watermark text={\faPython},watermark opacity=0.25,watermark zoom=0.50,% diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex index 4e0511aa83..8456b1601e 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex @@ -38,7 +38,7 @@ Cadre=true,% BarreTitre=true,% Titre={{\scriptsize\faCode} Code Python},% - EspacementV=\baselineskip,% + EspacementV=0.5\baselineskip,% CouleurNombres=orange } @@ -143,7 +143,7 @@ \tcbset{consolepylua/.style={%base de la boîte enhanced,colback=white,colframe=ForestGreen,sharp corners,boxrule=1pt,% top=1.5mm,bottom=1.5mm,left=2mm,right=2mm,fontupper=\footnotesize,% - before skip=\baselineskip,after skip=\baselineskip,% + before skip=0.5\baselineskip,after skip=0.5\baselineskip,% } } diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-pythontex.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-pythontex.tex index 30690cb49a..1394813fdf 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-pythontex.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-pythontex.tex @@ -51,15 +51,15 @@ \defKV[envpythonverb]{% Largeur=\def\CODPYlargeur{#1},% TaillePolice=\def\CODPYfonte{#1},% - EspacementVertical=\def\CODPYstretch{#1},% - Centre=\testboolKV{#1} - {\def\verbcenterpre{\begin{center}}\def\verbcenterpost{\end{center}}} - {\def\verbcenterpre{}\def\verbcenterpost{}} + EspacementVertical=\def\CODPYstretch{#1} +% Centre=\testboolKV{#1} +% {\def\verbcenterpre{\begin{center}}\def\verbcenterpost{\end{center}}} +% {\def\verbcenterpre{}\def\verbcenterpost{}} } \setKVdefault[envpythonverb]{% Largeur=\linewidth,% - Centre=false,% +% Centre=false,% Lignes=true,% TaillePolice=\footnotesize,% EspacementVertical=1 @@ -70,7 +70,7 @@ \tcbset{stylepythontex/.style={% enhanced,boxrule=1.25pt,% sharp corners=downhill,arc=12pt, - before skip=\baselineskip,after skip=\baselineskip,% + before skip=0.5\baselineskip,after skip=0.5\baselineskip,% top=\baselineskip,bottom=1mm,right=5mm,left=0.6em, attach boxed title to top right={yshift=-\tcboxedtitleheight}, boxed title style={ @@ -98,12 +98,12 @@ } } -\newtcolorbox{tcpythontexcode}[1][\linewidth]{% - width=#1,stylepythonlineos +\newtcolorbox{tcpythontexcode}[2][\linewidth]{% + width=#1,stylepythonlineos,#2 } -\newtcolorbox{tcpythontexcodeno}[1][\linewidth]{% - width=#1,stylepythonnolineos +\newtcolorbox{tcpythontexcodeno}[2][\linewidth]{% + width=#1,stylepythonnolineos,#2 } \NewDocumentEnvironment{CodePythontex}{ O{} m } @@ -111,10 +111,10 @@ \useKVdefault[envpythonverb]% \setKV[envpythonverb]{#1}% on paramètres les nouvelles clés et on les simplifie \VerbatimEnvironment - \verbcenterpre +% \verbcenterpre \ifboolKV[envpythonverb]{Lignes}%si lignes=true - {\begin{tcpythontexcode}[\CODPYlargeur]} - {\begin{tcpythontexcodeno}[\CODPYlargeur]} + {\begin{tcpythontexcode}[\CODPYlargeur]{#2}} + {\begin{tcpythontexcodeno}[\CODPYlargeur]{#2}} \ifboolKV[envpythonverb]{Lignes}%si lignes=true {\begin{pyverbatim}[][fontsize=\CODPYfonte,numbers=left,numbersep=0.75em,commandchars=\\\{\},mathescape,baselinestretch=\CODPYstretch]} {\begin{pyverbatim}[][numbers=none,numbersep=0pt,fontsize=\CODPYfonte,commandchars=\\\{\},mathescape,baselinestretch=\CODPYstretch]} @@ -124,14 +124,14 @@ \ifboolKV[envpythonverb]{Lignes}%si lignes=true {\end{tcpythontexcode}} {\end{tcpythontexcodeno}} - \verbcenterpost +% \verbcenterpost } %v2 \tcbset{stylepythontexalt/.style={% enhanced,boxrule=0.75pt,colframe=DarkGray!50!Black,% sharp corners,top=0mm,bottom=0mm,left=0.2em,right=5mm,% - before skip=\baselineskip,after skip=\baselineskip,% + before skip=0.5\baselineskip,after skip=0.5\baselineskip,% colback=white, fontupper=\footnotesize,fontlower=\footnotesize,% title={{\scriptsize\faCode} Code Python}, @@ -157,22 +157,22 @@ } } -\newtcolorbox{tcpythontexcodealt}[1][\linewidth]{% - width=#1,stylepythonlineosalt +\newtcolorbox{tcpythontexcodealt}[2][\linewidth]{% + width=#1,stylepythonlineosalt,#2 } -\newtcolorbox{tcpythontexcodenoalt}[1][\linewidth]{% - width=#1,stylepythonnolineosalt +\newtcolorbox{tcpythontexcodenoalt}[2][\linewidth]{% + width=#1,stylepythonnolineosalt,#2 } \NewDocumentEnvironment{CodePythontexAlt}{ O{} m } {% \useKVdefault[envpythonverb]% \setKV[envpythonverb]{#1}% on paramètres les nouvelles clés et on les simplifie \VerbatimEnvironment - \verbcenterpre +% \verbcenterpre \ifboolKV[envpythonverb]{Lignes}%si lignes=true - {\begin{tcpythontexcodealt}[\CODPYlargeur]} - {\begin{tcpythontexcodenoalt}[\CODPYlargeur]} + {\begin{tcpythontexcodealt}[\CODPYlargeur]{#2}} + {\begin{tcpythontexcodenoalt}[\CODPYlargeur]{#2}} \ifboolKV[envpythonverb]{Lignes}%si lignes=true {\begin{pyverbatim}[][fontsize=\CODPYfonte,numbers=left,numbersep=0.75em,commandchars=\\\{\},mathescape,baselinestretch=\CODPYstretch]} {\begin{pyverbatim}[][numbers=none,numbersep=0pt,fontsize=\CODPYfonte,commandchars=\\\{\},mathescape,baselinestretch=\CODPYstretch]} @@ -182,7 +182,7 @@ \ifboolKV[envpythonverb]{Lignes}%si lignes=true {\end{tcpythontexcodealt}} {\end{tcpythontexcodenoalt}} - \verbcenterpost +% \verbcenterpost } \endinput \ No newline at end of file -- cgit v1.2.3