Commit Graph
899 Commits
Author SHA1 Message Date
John MacFarlane b6aff21452 Docx writer: restart footnotes by section by default.
This can be overridden by a final sectPr element in the body
of the reference.docx.

It will only change things for `--top-level-division=chapter`,
since only top-level chapters are put in separate sections.
For that use it will mean that footnote numbers start over with
each chapter, which is usually what is wanted.

Closes #2773.
2024-12-22 13:18:27 -08:00
John MacFarlaneandThomas Hodgson 86dd2f7d66 Fix default.beamer nocite location.
It must be inside a frame or it is ignored.

Improves on #10465. Obsoletes #10471.

Co-authored-by:  Thomas Hodgson <hello@twshodgson.net>
2024-12-19 14:54:04 -08:00
John MacFarlane 7a66c946e2 Docx writer: use styleIds not styleNames for Title, Subtitle, etc.
This change affects the default openxml template as well as the
OpenXML writer.

Closes #10282 (regression introduced in pandoc 3.5).
2024-12-17 17:33:17 -08:00
Thomas Hodgson 7d1962b617 Move nocites from LaTeX preamble to body (#10465)
Closes #10461.

Putting `\nocite` in the preamble works only with biblatex.
2024-12-17 10:17:13 -08:00
John MacFarlane be734d2543 Remove definitions.typst partial.
Remove unnecessary definition of `endnote`.
Incorporate the one remaining definition into `default.typst`.
2024-11-11 10:23:18 -08:00
John MacFarlane d5d2821a4d Typst writer: make template sensitive to a page-numbering variable.
This can be set to an empty string (or, in metadata, to false) for
no page numbers.

Addresses #10370.
2024-11-09 11:38:08 -08:00
John MacFarlane 39b87d4d28 Adjust test suite for typst template changes.
Note: the new templates presuppose typst 0.12; if you try to
use an earlier version of typst, an error will be raised.
2024-10-29 14:49:06 -07:00
Luis Rivera e01023c1f4 Issue10294 new code for two column layout on typst 0.12.x (#10324)
Update typst template to be compatible with two-column layout with
typst 0.12.  Layout instructions for two column layout has changed:
see https://github.com/typst/typst/issues/5215.

Closes #10294.
2024-10-29 14:22:49 -07:00
Jens ca30f4930d Update ua.yaml
Fix a typo from
See.: див.
to
See: див.
2024-10-29 14:19:12 -07:00
John MacFarlane 233301bacb Add font-settings.latex partial to the repository.
Fixes th efix to #6160.
2024-10-23 20:46:27 -07:00
John MacFarlane 516931f4b5 LaTeX/Beamer template changes.
- Split fonts.latex partial into two parts: fonts.latex and
  font-settings.latex.
- In beamer template, load beamer theme between fonts.latex and
  font-settings.latex. This allows a theme (such as metropolis)
  to set its own default font, while still allowing the user to
  override it.

This fixes a regression in pandoc 3.5.

Users who have custom templates based on pandoc 3.5 templates will
need to add `font-settings.latex()` after `fonts.latex()` in the
latex template. In a beamer template, the beamer theme-setting
code needs to be moved between these two partials.

Closes #10297.
2024-10-23 19:17:51 -07:00
John MacFarlane 3833a9d27e ConTeXt template: ensure that font names don't wrap.
Closes #10305.
2024-10-21 20:22:58 -07:00
John MacFarlane bdb1172385 Typst writer: make smart extension work.
If `smart` is not enabled, a command in the default template will
disable smartquote substitutions.

When `smart` is enabled, render curly apostrophes as straight
and escape straight apostrophes.

When `smart` is disabled, render curly apostrophes as curly
and don't escape straight apostrophes.

And similarly for quotes, em and en dashes.

This should give more idiomatic typst output, with fewer unnecessary
escapes.

Closes #10271.
2024-10-08 21:58:25 -07:00
Suraj Patil de034b70f8 epub.css: remove background-color (#10264)
With this greyish background color, epubs look bad on a Kindle.
Closes #10263.
2024-10-07 08:00:52 -07:00
Thomas Hodgson dbc80f9745 Support short title, author, etc. in Beamer (#10244)
+ Add `shorttitle`, `shortsubtitle`, `shortauthor`, `shortinstitute`, `shortdate`
   to default.beamer.
+ Note that the brackets are inside conditionals, because some older beamer
    versions don't allow the empty optional argument.

Closes #10248.
2024-10-01 12:29:44 -07:00
Thomas Hodgson f2b1de5397 Make --number-sections work with beamer (#10245)
+ Remove section numbering code from common.latex
+ Add section numbering to default.latex
+ Add logic for numbering sections in default.beamer. I moved the template setting
   code to where other beamer templates are set. This makes the section-titles and
   numbersections variables independent.

This should make --number-sections work with beamer.
2024-10-01 12:26:28 -07:00
Thomas Hodgson e583ab7970 Support a list of images for titlegraphic (#10246)
Allow a list of title graphics in default.beamer
Title graphic options will be applied to each title graphic.
Images will be separated by `\enspace`.
2024-10-01 11:07:13 -07:00
Thomas Hodgson 3ba968292b Beamer theme options (#10243)
Add theme options to default.beamer: `colorthemeoptions`, `fontthemeoptions`,
`innerthemeoptions`, `outerthemeoptions`.
2024-10-01 11:02:43 -07:00
John MacFarlane 0dc660550d Move beamerarticle code from beamer -> latex template. 2024-10-01 09:06:43 -07:00
John MacFarlane c9c40eee8f Beamer template doesn't need amsmath,amssym.
These are loaded by beamer automatically.
2024-09-29 21:27:01 -07:00
John MacFarlane 2406ec1cdb Remove font-settings.tex partial.
We incorporate this into fonts.tex, and move the beamer theme-setting
commands before both of them.
2024-09-29 21:26:56 -07:00
John MacFarlane 2a6268de67 Refactor latex template using partials.
+ Split out common parts of latex template into partials: common.latex,
  fonts.latex, font-settings.latex, passoptions.latex, hypersetup.latex,
  after-header-includes.latex.
+ Split out old latex template into default.latex and default.beamer.
+ Make default.beamer the default template for beamer.
2024-09-29 14:18:31 -07:00
Akash PatelandJohn MacFarlane ca348940e3 Add support for list of figures (lof) and list of tables (lot) (#10029)
Two new command-line options are added:

`--lof[=true|false]`, `--list-of-figures[=true|false]`
`--lot[=true|false]`, `--list-of-tables[=true|false]`

Only docx, latex, and context are supported at this point.

Setting the `lof` and `lot` variables will also work for the formats that are
currently supported.

[API changes]

+ Lua: `list_of_figures` and `list_of_tables` can now be used in writer options.
+ Text.Pandoc.Options:  add `writerListOfFigures` and `writerListOfTables` fields
  to `WriterOptions`.
+ Text.Pandoc.App.Opt: add `optListOfFigures` and `optListOfTables` to `Opt`.

Closes #8245.

Co-authored-by: John MacFarlane <jgm@berkeley.edu>
2024-09-22 11:49:52 -07:00
Albert Krewinkel 5ccf380dad JATS template: support floats-group
The content of the `floats-group` variable is now rendered in a
`<floats-group>` element when using the *publishing* or *archiving* tag
sets.

Discussion: #10196
2024-09-20 17:36:36 +02:00
John MacFarlane a27dad6f68 Add options to change table/figure caption positions.
+ Add command line options `--table-caption-position` and
  `--figure-caption-position`. These allow the user to specify whether
  to put captions above or below tables and figures, respectively.
  The following output formats are supported: HTML (and related such
  as EPUB), LaTeX (and Beamer), Docx, ODT/OpenDocument, Typst.

+ Text.Pandoc.Options: add `CaptionPosition` and new
  `WriterOptions` fields `writerFigureCaptionPosition` and
  `writerTableCaptionPosition` [API change].

+ Text.Pandoc.Opt: add `Opt` fields `optFigureCaptionPosition` and
  `optTableCaptionPosition` [API change].

+ Docx writer: make table/figure rendering sensitive to caption
  position settings.

+ OpenDocument writer: make table/figure rendering sensitive to
  caption position settings.

+ Typst writer/template: implement figure caption positions by
  triggering a show rule in the default template, which determines caption
  positions for figures and tables globally.

+ LaTeX writer: make table/figure rendering sensitive to caption
  position settings. Closes #5116.

+ HTML writer/template: make `<figcaption>` placement sensitive to caption
  position settings.  For tables, `<caption>` must be the first element,
  and positioning is determined by CSS, for here we set a variable
  which the default template is sensitive to.
2024-09-08 08:29:09 -07:00
Evan Silberman d09477400f Introduce ANSI writer for formatted console output
The ANSI writer (-t ansi) outputs a document formatted with ANSI control
sequences for reading on the console.

Most Pandoc elements are supported and printed in a reasonable way, if
not always ideally. This version does no detection of terminal
capabilities nor does it fall back to different output styles for
less-capable terminals.

Some gory details:

- Title blocks are formatted with modest extravagance in --standalone
  mode.
- Strong, Emph, Underline, and Strikeout spans are all formatted
  accordingly using SGR codes (which will be silently ignored by
  terminals that don't support them).
- Headings have somewhat arbitrary styles applied to them that
  probably need immediate improvement.
- Blockquotes and all flavors of list look pretty good.
- Code spans are colored magenta-on-white, which on the author's
  terminal looks kind of like the pinkish treatment of code spans used
  by many stylesheets. This probably isn't a good final decision.
- Code blocks are formatted by Skylighting's formatANSI using standard
  writer options and included directly in the output. This has some
  issues; see code comments.
- Links are printed with OSC 8 to create hyperlinks and colored cyan.
  The author's terminal automatically adds a dotted-underline to OSC 8
  hyperlinks, but only colors them differently on command-mouseover.
  Setting an underlined style on links may be more broadly accessible.
  OSC 8 support is not checked for, so on terminals not supporting it or
  with support disabled, the link text will be colored but not do
  anything and the links will not be printed.
- Images are displayed as their alt text. Support for the Kitty and
  iTerm 2 inline image protocols is planned. Supporting other terminals
  by using Chafa (https://hpjansson.org/chafa/) to print sixels etc would
  be cool too but the author would have to do some FFI stuff and it would
  add a dependency to Pandoc.
- Tables are replaced with a useless placeholder. Table output using
  box-drawing characters is desired.
- Subscripts and Superscripts are just parenthesized when accurate Unicode
  representations aren't available. Because these span types could have
  all kinds of semantics, there's not an obvious thing to do with them.
- Simple math is translated to Pandoc inlines using existing
  functionality.  An ambitious person could look into emulating the
  console-mode math output of a computer algebra system, or rendering each
  display math element as an image with TeX or Typst and including it, or
  some other thing.
2024-09-02 11:08:13 -07:00
Gordon Woodhull 2575490c17 typst template: move header-includes before show doc (#10070)
Closes #9996.
2024-08-08 09:18:21 -07:00
Ian Max Andolina f31c065cc1 ODT: Add TableCaption to styles.xml (#10058) 2024-08-06 10:29:15 -07:00
Jonathan d89681179d default.latex: wrong beamer color in (sub)section page
The default.latex template defines "part title", "section title" and
"subsection title" via \setbeamertemplate. But for "section title" and
"subsection title", the beamercolorbox also used the "part title"
parameter instead of the "(sub)section title". This had the effect that
for (sub)section pages the color attributes of the part title were used.
2024-07-29 10:52:16 -07:00
Stephen Huan 2d60d006d7 Add new translations 2024-07-05 13:04:15 -07:00
Stephen Huan b61868d8f0 Update existing translations 2024-07-05 13:04:15 -07:00
Stephen Huan 764782a129 Remove colon from pl translation 2024-07-05 13:04:15 -07:00
Stephen Huan 87bc3be656 Sort ar translation 2024-07-05 13:04:15 -07:00
Stephen Huan 0b5285d26f Fix YAML in translation files for is 2024-07-05 13:04:15 -07:00
John MacFarlane 60c0149084 Man writer: use default middle header when metadata does not...
include `header`.  This change causes pandoc to omit the middle
header parameter when `header` is not set, rather than
emitting `""`.  The parameter is optional and man will use
a default based on the section if it is not specified.

Closes #9943.
2024-07-03 16:25:55 -06:00
Jens Oehlschlägel 217adafcb5 add ua.yaml 2024-06-30 17:00:13 -06:00
Stephen Huan f0bc45aa93 Add Japanese translations 2024-06-30 10:31:58 -06:00
John MacFarlane 59cc5c3725 HTML templates: don't load polyfill.
This was added in a period when MathJaX required polyfill.
MathJaX no longer recommends this and polyfill should no
longer be necessary on any reasonably modern browser.

Closes #9918.
2024-06-26 23:46:18 -06:00
John MacFarlane 26b25a4428 LaTeX writer: new method for ensuring images don't overflow.
Previously we relied on graphicx internals and made global
changes to Gin to force images to be resized if they exceed
textwidth.  This approach is brittle and caused problems
with `\includesvg` (see #9660).

The new approach uses a new macro `\pandocbounded` that is
now defined in the LaTeX template. (Thanks here to Falk Hanisch in
https://github.com/mrpiggi/svg/issues/60.)

The LaTeX writer has been changed to enclose `\includegraphics`
and `\includesvg` commands in this macro when they don't explicitly
specify a width or height.

In addition, the writer now adds `keepaspectratio` to the
`\includegraphics` or `\includesvg` options if `height` is specified
without width, or vice versa. Previously, this was set in the preamble
as a global option.

Compatibility issues:

- If custom templates are used with the new LaTeX writer, they will have
  to be updated to include the new `\pandocbounded` macro, or an error
  will be raised because of the undefined macro.

- Documents that specify explicit dimensions for an image may render
  differently, if the dimensions are greater than the line width or
  page height. Previously pandoc would shrink these images to fit,
  but the new behavior takes the specified dimensions literally.
  In addition, pandoc previously always enforced `keepaspectratio`,
  even when width and height were both specified, so images with
  width and height specified that do not conform to their intrinsic
  aspect ratio will appear differently.

Closes #9660.
2024-06-23 16:12:37 -07:00
John MacFarlane cd9753d4af LaTeX writer/template: specify language option for selnolig...
...and only include it if `english` or `german` is used.

Since 3d8f011, the babel language is not specified as a
class option any more; so now we need to explicitly specify
the language option when we load `selnolig`.  Only `german`
and `english` are valid, so we construct the variable
`selnolig-langs` in the writer and include `selnolig` if it
is nonempty.

This should restore proper ligature suppression when
lualatex is used.

Closes #9863. Supersedes #9864.

Thanks to @fkohrt for the initial fix.
2024-06-10 19:33:43 -07:00
John MacFarlane 8e227ab059 LaTeX template: put babel-lang in options to beamer.
This is required to make beamer use proper localized terms for
things like "Section." Closes #9868.
2024-06-10 08:57:05 -07:00
John MacFarlane 684668db1e Fix --toc-depth with beamer output.
Previously only top-level sections were ever included in the TOC,
regardless of the setting of `--toc-depth`.

Closes #9861.
2024-06-08 17:35:00 -07:00
John MacFarlane b9491ccbbc Support supplementary-material in metadata for jats_articlepublishing.
See #9818.
2024-06-03 09:37:35 -07:00
John MacFarlane 7abfec3d2c Fix typo in fix to template.typst. 2024-05-30 18:24:52 -06:00
John MacFarlane 0e92d9483c Typst template: use content rather than string...
...for title, author, date, email.

Fixes #9823 (escaped `\@` in rendered email).
Allows formatting in title, author, date, and email fields.
Since the PDF metadata requires a string, and typst only
converts the title to a string (not the authors), we use
a small function content-to-string to do this conversion.
Background: https://github.com/typst/typst/issues/2196
2024-05-30 12:00:48 -06:00
John MacFarlane 61bc9a0c47 ConTeXt template: remove \setupbackend[export=yes].
This doesn't seem necessary for what we're doing, and it causes a
crash due to a bug in ConTeXt.  Closes #9820.
2024-05-30 09:38:35 -06:00
John MacFarlane f874997f18 Fix abstract-title in openxml template. 2024-05-19 19:20:08 -07:00
John MacFarlane db559e100c Allow OpenXML templates to be used with docx.
The `--reference-doc` option allows customization of styles in docx
output, but it does not allow one to adjust the content of the output
(e.g., changing the order in which metadata, the table of contents,
and the body of the document are displayed), or adding boilerplate
text before or after the document body.  For these changes, one can
now use `--template` with an OpenXML template.  (See the default
`openxml` template for a sample.)

This patch also allows `--include-before-body` and
`--include-after-body` to be used with `docx` output.
The included files must be OpenXML fragments suitable for
inclusion in the document body.

Closes #8338 (`--include-before-body`, `--include-after-body`).

Closes #9069 (a custom template can be used to omit the
title page).

Closes #7256.

Closes #2928.
2024-05-19 13:09:21 -07:00
John MacFarlane c26211b0c9 Cleaned up Abstract Title and Subtitle in default reference docx.
Center Subtitle, remove color.
2024-05-18 10:50:07 -07:00
John MacFarlane dbef49050e texinfo template: add variables for filename and version 2024-05-15 17:42:41 -07:00