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.
In some cases we need to break up a long text run including
both western and East Asian text, so that the punctuation in
the western text doesn't become double-wide.
Closes#9817.
- Turn captioned images into Figure elements. Closes#9391.
- Improve the logic for associating elements with captions.
Closes#9358.
- Ensure that captions that can't be associated with an
element aren't just silently dropped. Closes#9610.
...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.
Pandoc used to emit a `header` class on the `tr` element that forms the table header. This is no longer needed, because `head > tr` will do the same thing.
Similarly, pandoc used to emit `even` and `odd` classes on `tr`s, allowing striped styling. This is no longer needed, because one can use e.g. `tbody tr:nth-child(2n)`.
We now omit these classes, which have a good chance of conflicting with classes used for other things.
Closes#9325.
Task lists are now properly formatted, with no bullet.
In addition, we have removed an expensive generic traverse to
remove Space elements, and replaced it with code in
`inlinesToOpenXML`. This should give better performance; it
also reduces XML size in the metadata, which wasn't previously
affected by the de-Spacing.
TODO: parse this in the reader so that we can have task lists round-trip.
Closes#5198.
This extends support for fine-grained properties in Typst.
If the `typst:no-figure` class is present on a Table, the table will not be placed in a figure.
If the `typst:figure:kind` attribute is present, its value will be used for the figure's `kind`.
These features are documented in `doc/typst-property-output.md`.
Closes#9777.
The new OpenXML template had spaces for metadata that need
to be filled with OpenXML fragments with the proper shape.
This patch ensures that everything is the right shape.
Closes#9828.
...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
We do this when the text in the run contains any CJK characters.
This ensures that ambiguous code points (e.g. quotation marks)
will be represented as "wide" characters when together with CJK
characters.
Closes#9817.
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.
Fixes#7473
Previously, `figclass`es weren't being extracted correctly.
`figclass` and `align` annotations are now implemented following the rst docs: these options apply to the figure while other options are passed onto the underlying image.