diff --git a/.gitignore b/.gitignore index 24e22358b..d24426948 100644 --- a/.gitignore +++ b/.gitignore @@ -16,21 +16,18 @@ examples/latex-luatex.aux examples/latex-luatex.log examples/latex-luatex.markdown.in examples/latex-luatex.pdf -examples/latex-luatex.tex examples/latex-pdftex.aux examples/latex-pdftex.log examples/latex-pdftex.markdown.in examples/latex-pdftex.markdown.lua examples/latex-pdftex.markdown.out examples/latex-pdftex.pdf -examples/latex-pdftex.tex examples/latex-xetex.aux examples/latex-xetex.log examples/latex-xetex.markdown.in examples/latex-xetex.markdown.lua examples/latex-xetex.markdown.out examples/latex-xetex.pdf -examples/latex-xetex.tex examples/_markdown_context-mkii/ examples/_markdown_context-mkiv/ examples/_markdown_example/ diff --git a/CHANGES.md b/CHANGES.md index ccf6113a9..0086e4d92 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,8 @@ Documentation: - Add a link to a preprint from TUGboat 44(1) to `README.md`. (#234, a4d9fbf) +- Separate example files for pdfLaTeX, XeLaTeX, LuaLaTeX, and + TeX4ht. (#291) Refactoring: diff --git a/Makefile b/Makefile index c0c0eefe5..e31def174 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,10 @@ CTANARCHIVE=markdown.ctan.zip DISTARCHIVE=markdown.zip ARCHIVES=$(TDSARCHIVE) $(CTANARCHIVE) $(DISTARCHIVE) EXAMPLES_RESOURCES=examples/example.md examples/scientists.csv -EXAMPLES_SOURCES=examples/context-mkii.tex examples/context-mkiv.tex examples/latex.tex +EXAMPLES_SOURCES=examples/context-mkii.tex examples/context-mkiv.tex \ + examples/latex-pdftex.tex examples/latex-xetex.tex examples/latex-luatex.tex EXAMPLES=examples/context-mkii.pdf examples/context-mkiv.pdf \ - examples/latex-pdftex.pdf examples/latex-luatex.pdf \ + examples/latex-pdftex.pdf examples/latex-xetex.pdf examples/latex-luatex.pdf \ examples/latex-tex4ht.html examples/latex-tex4ht.css TESTS=tests/test.sh tests/support/*.tex tests/templates/*/*.tex.m4 \ tests/templates/*/COMMANDS.m4 tests/testfiles/*/*.test @@ -183,23 +184,23 @@ $(TDSARCHIVE): $(DTXARCHIVE) $(INSTALLER) $(INSTALLABLES) $(DOCUMENTATION) $(EXA cp $(DOCUMENTATION) doc/generic/markdown/ cp examples/context-mkii.tex examples/context-mkiv.tex $(EXAMPLES_RESOURCES) \ doc/context/third/markdown/examples/ - cp examples/latex.tex $(EXAMPLES_RESOURCES) doc/latex/markdown/examples/ + cp -L examples/latex-*.tex $(EXAMPLES_RESOURCES) doc/latex/markdown/examples/ @# Installing the sources. mkdir -p source/generic/markdown cp $(DTXARCHIVE) $(INSTALLER) source/generic/markdown - zip -r -v -nw $@ doc scripts source tex + zip -MM -r -v -nw $@ doc scripts source tex rm -rf doc scripts source tex # This target produces the distribution archive. $(DISTARCHIVE): $(EVERYTHING) $(TDSARCHIVE) -ln -s . markdown - zip -MM -r -v -nw $@ $(addprefix markdown/,$(EVERYTHING)) $(TDSARCHIVE) + zip -MM -r -v -nw --symlinks $@ $(addprefix markdown/,$(EVERYTHING)) $(TDSARCHIVE) rm -f markdown # This target produces the CTAN archive. $(CTANARCHIVE): $(DTXARCHIVE) $(INSTALLER) $(DOCUMENTATION) $(EXAMPLES_RESOURCES) $(EXAMPLES_SOURCES) $(LIBRARIES) $(TDSARCHIVE) -ln -s . markdown - zip -MM -r -v -nw $@ $(addprefix markdown/,$(DTXARCHIVE) $(INSTALLER) $(DOCUMENTATION) $(EXAMPLES_RESOURCES) $(EXAMPLES_SOURCES) $(LIBRARIES)) $(TDSARCHIVE) + zip -MM -r -v -nw --symlinks $@ $(addprefix markdown/,$(DTXARCHIVE) $(INSTALLER) $(DOCUMENTATION) $(EXAMPLES_RESOURCES) $(EXAMPLES_SOURCES) $(LIBRARIES)) $(TDSARCHIVE) rm -f markdown # This pseudo-target removes any existing auxiliary files and directories. diff --git a/examples/Makefile b/examples/Makefile index 03de7c4cb..73817dd8a 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -2,7 +2,6 @@ AUXFILES=*.tmp *.tui *.tuo *.mp *.tuc *.markdown.in *.markdown.out \ *.markdown.lua *.log *.aux *.dvi *.idv *.lg *.tmp *.xref *.4ct *.4tc \ - latex-pdftex.tex latex-luatex.tex latex-tex4ht.tex \ example.tex *.debug-extensions.json debug-extensions.json AUXDIRS=_markdown_*/ LUACLI_OPTIONS=\ @@ -27,8 +26,9 @@ LUACLI_OPTIONS=\ texMathDollars=true \ texMathDoubleBackslash=true \ texMathSingleBackslash=true -OUTPUT=context-mkii.pdf context-mkiv.pdf latex-pdftex.pdf \ - latex-luatex.pdf latex-tex4ht.html latex-tex4ht.css +OUTPUT=context-mkii.pdf context-mkiv.pdf \ + latex-pdftex.pdf latex-xetex.pdf latex-luatex.pdf \ + latex-tex4ht.html latex-tex4ht.css # This is the default pseudo-target. all: $(OUTPUT) @@ -43,20 +43,22 @@ context-mkiv.pdf: context-mkiv.tex example.tex context context-mkiv.tex # This target typesets the LaTeX example using the pdfTeX engine. -latex-pdftex.pdf: latex.tex example.tex - cp latex.tex latex-pdftex.tex - pdflatex --shell-escape latex-pdftex - pdflatex --shell-escape latex-pdftex +latex-pdftex.pdf: latex-pdftex.tex example.tex + pdflatex --shell-escape $< + pdflatex --shell-escape $< + +# This target typesets the LaTeX example using the XeTeX engine. +latex-xetex.pdf: latex-xetex.tex example.tex + xelatex --shell-escape $< + xelatex --shell-escape $< # This target typesets the LaTeX example using the LuaTeX engine. -latex-luatex.pdf: latex.tex example.tex - cp latex.tex latex-luatex.tex - lualatex latex-luatex - lualatex latex-luatex +latex-luatex.pdf: latex-luatex.tex example.tex + lualatex $< + lualatex $< # This target typesets the LaTeX example using TeX4ht. -latex-tex4ht.html latex-tex4ht.css: latex.tex example.tex - cp latex.tex latex-tex4ht.tex +latex-tex4ht.html latex-tex4ht.css: latex-tex4ht.tex example.tex make4ht --shell-escape latex-tex4ht fn-in # This target converts the markdown example to a plain TeX representation diff --git a/examples/latex.tex b/examples/latex-luatex.tex similarity index 81% rename from examples/latex.tex rename to examples/latex-luatex.tex index 44736c61d..df71ee86d 100644 --- a/examples/latex.tex +++ b/examples/latex-luatex.tex @@ -1,19 +1,7 @@ \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{polyglossia} +\setmainlanguage{english} +\usepackage{fontspec} \usepackage{booktabs} \usepackage[ contentBlocks, diff --git a/examples/latex-pdftex.tex b/examples/latex-pdftex.tex new file mode 100644 index 000000000..be475feef --- /dev/null +++ b/examples/latex-pdftex.tex @@ -0,0 +1,73 @@ +\documentclass{book} +\usepackage[english]{babel} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\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: + + + + + + + + + + + + +
EmilTobiasLinus
161410
+\end{markdown*} +\end{document} diff --git a/examples/latex-tex4ht.tex b/examples/latex-tex4ht.tex new file mode 120000 index 000000000..ea6875c59 --- /dev/null +++ b/examples/latex-tex4ht.tex @@ -0,0 +1 @@ +latex-pdftex.tex \ No newline at end of file diff --git a/examples/latex-xetex.tex b/examples/latex-xetex.tex new file mode 120000 index 000000000..d18d544a1 --- /dev/null +++ b/examples/latex-xetex.tex @@ -0,0 +1 @@ +latex-luatex.tex \ No newline at end of file diff --git a/markdown.dtx b/markdown.dtx index a8689845a..8f6030458 100644 --- a/markdown.dtx +++ b/markdown.dtx @@ -1603,13 +1603,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.