Skip to content

Instantly share code, notes, and snippets.

@zr-tex8r
Created December 12, 2023 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zr-tex8r/2252cf6472704c385801544f38f2ba22 to your computer and use it in GitHub Desktop.
Save zr-tex8r/2252cf6472704c385801544f38f2ba22 to your computer and use it in GitHub Desktop.
A document source that can be compiled both as plain TeX and Typst (polyglot)
// \begingroup \catcode`\#=12
#let s = ```
\endgroup \newdimen\pwd \newdimen\pht
\pwd=160bp \pht=90bp
\ifnum\ifx\pdfoutput\unDef0\else\pdfoutput\fi>0
\pdfpagewidth=\pwd \pdfpageheight=\pht \let\os\relax
\else \def\os{\special{papersize=\the\pwd,\the\pht}}\fi
\shipout\vbox to\pht{\os \font\ff=cmr10 at 36bp \vskip-1inplus1fil
\moveleft1in\hbox to\pwd{\hfil\ff \TeX!!\hfil}\vskip1inplus1fil}
\output{\setbox0\box255\deadcycles=0}\bye
```
#page(width: 160pt, height: 90pt, {
v(18pt);
align(center, text(size: 36pt)[Typst]);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment