Commit graph

102 commits

Author SHA1 Message Date
John MacFarlane
9053214fba LaTeX template: Move urlstyle and xurl commands to after hyperref.
Closes #7978.
2022-03-21 10:42:18 -07:00
John MacFarlane
c9cf8568bf LaTeX template: Fix regression with code in footnotes...
...due to moving hyperref later in the template.

Closes #7964.
2022-03-14 12:28:56 -07:00
John MacFarlane
8d3959ea29 Remove special redefinition of \sout.
This used to be necessary to avoid problems with hyperref,
when headings contain strikeout text, but it does not seem to be
necessary any more (tested).
2022-03-13 17:18:31 -07:00
John MacFarlane
6328ac5097 LaTeX template: Move \sout correction after hyperref.
This fixes the previous change the default.latex.
2022-03-13 15:25:32 -07:00
John MacFarlane
f3fcdd52c8 LaTeX template: move hyperref near end of preamble.
It now comes after header-includes and right before title, author, date,
abstract.

The hyperref documentation says: “Make sure it comes last of your loaded
packages”. The reason is that it redefines many LaTeX commands.

For example, loading it after titlesec (which might be loaded in
header-includes) causes links in the table of contents to point to
the wrong page (#7960).

Closes #5811.

Note:  Users who presuppose hyperref in their header-includes
will now have to add `\usepackage{hyperref}` to their header-includes
to make it available there.  (The redundant `\usepackage` will
do no harm in this case.)
2022-03-13 10:48:09 -07:00
John MacFarlane
bc7f74968e LaTeX template: skip \babelprovide if babel-lang is empty.
This avoids an error.  See #7945.
2022-03-02 08:52:13 -08:00
John MacFarlane
3f489bcb58 Ensure that babel is loaded also with pdflatex.
This fixes a regression in #7604, which modernized
babel usage but omitted to load babel for pdflatex,
with the result that even simple documents could no
longer be produced.

Closes #7627.
2021-10-16 23:34:53 -07:00
hseg
da8bcb783b Make babel use more idiomatic
* Use `babel`'s bidi implementation
* Remove global `lang` option -- it broke eg hebrew
* Import babel languages individually instead of as package options --
  was broken for greek, hebrew
* Move `header-includes` to after `babel` setup

Closes #7604
2021-10-03 19:16:50 -07:00
John MacFarlane
dd7b83ac91 Use babel, not polyglossia, with xelatex.
Previously polyglossia worked better with xelatex, but
that is no longer the case, so we simplify the code so that
babel is used with all latex engines.

This involves a change to the default LaTeX template.
2021-09-19 09:40:59 -07:00
John MacFarlane
1f1a30bbf6 LaTeX writer: Use ulem for underline.
ulem is conditionally included already when the `strikeout`
variable is set, so we set this when there is underlined text,
and use `\uline` instead of `\underline`.

This fixes wrapping for underlined text.
Closes #7351.
2021-07-22 23:05:43 -07:00
John MacFarlane
972db3cdca Revert "LaTeX template: move title, author, date up to top of preamble."
This reverts commit cc088687b4
and PR #7295.

This fixes issues people had when using LaTeX commands defined later
in the preamble (or in some cases UTF-8 text) in the title or author
fields.  Closes #7422.
2021-07-03 15:34:42 -07:00
John MacFarlane
fa23effe25 LaTeX template: improve treatment of CSL entry-spacing.
Previously with the default template settings (`indent` variable
not set), we would get interparagraph spaces separating bib
entries even with `entry-spacing="0"`.  On the other hand,
setting `entry-spacing="2"` gave ridiculously large spacing.
This change makes the spacing caused by `entry-spacing` a multiple
of `\parskip` by default, which gives aesthetically reasonable
output.  Those who want a larger or smaller unit (e.g. because
they use `indent` which sets `\parskip` to 0) may
`\setlength{\cslentryspacingunit}{10pt}` in header-includes
to override the defaults.

Closes #7296.
2021-05-17 20:46:49 -07:00
John MacFarlane
cc088687b4 LaTeX template: move title, author, date up to top of preamble.
This allows header-includes to use them, and puts them
in a position where you can see them immediately.
Closes #7295.
2021-05-16 14:35:13 -07:00
Albert Krewinkel
d92622ba3c
LaTeX template: define commands for zero width non-joiner character
Closes: #6639

The zero-width non-joiner character is used to avoid ligatures (e.g. in
German).
2021-05-16 12:33:32 -07:00
John MacFarlane
0e5b840c2a LaTeX template: Move CSL macro defs before header-includes.
This allows them to be overriden by header-includes.
Closes #7286.
2021-05-14 08:48:59 -07:00
John MacFarlane
ba4ec8c5c0 latex template: use non-starred names for xcolor color names.
This should make svgnames and x11names work properly.
Closes #6109.
2021-05-10 09:21:27 -06:00
badumont
b9b22e3ce4
Update default.latex (#7234)
Fix bad vertical spacing after the bibliography.
2021-04-29 18:47:23 -07:00
Julien Dutant
8fe7e8dd5c
list of figures before list of tables in LaTeX and ConTeXt templates (#7235) 2021-04-28 19:06:13 -07:00
John MacFarlane
3622097da3 Handle 'nocite' better with --biblatex and --natbib.
Previously the nocite metadata field was ignored with
these formats.  Now it populates a `nocite-ids` template
variable and causes a `\nocite` command to be issued.

Closes #4585.
2021-03-14 00:10:37 -08:00
Loïc Grobol
8123571e8e
Wrap url colours in braces in the default LaTeX template (#7121) 2021-02-26 10:05:30 -08:00
John MacFarlane
005344fb18 Revert "LaTeX template: disable ` ? ` and ! `` ligatures."
This reverts commit 24d7cd539b.
2021-02-18 17:03:11 -08:00
John MacFarlane
24d7cd539b LaTeX template: disable ` ? ` and ! `` ligatures.
These are often triggered by accident in languagegs that
use ` `` ` for end quote (e.g. German).

See jgm/citeproc#54.
2021-02-18 15:48:40 -08:00
Andrew Dunning
4de9edb8e8
LaTeX template: Update to iftex package (#7073)
Load the iftex package directly rather than via the ifxetex and ifluatex compatibility
wrappers, which have been merged into a single package that is part of the LaTeX core.
The capitalization of the commands has been changed for compatibility with older
versions of TeX Live that have the version of iftex by the Persian TeX Group. This had
been removed in
<2845794c0c>
for compatibility with BasicTeX, but that is no longer an issue.
2021-02-03 08:54:11 -08:00
Albert Krewinkel
8f402beab9
LaTeX writer: support colspans and rowspans in tables. (#6950)
Note that the multirow package is needed for rowspans.
It is included in the latex template under a variable,
so that it won't be used unless needed for a table.
2020-12-20 18:04:54 -08:00
John MacFarlane
8031ac137f LaTeX template: include csquotes package if csquotes variable set. 2020-12-07 18:57:24 -08:00
John MacFarlane
ea8097e412 latex template: put back amssymb
We need it for checkboxes in todo lists, and maybe for
other things.  In this location it seems compatible
with the cases that propmted #6469 and PR #6762.
2020-11-25 16:08:10 -08:00
John MacFarlane
7c4d7db9c7 LaTeX writer: improve longtable output.
- Don't create minipages for regular paragraphs.
- Put width and alignment information in the longtable column
  descriptors.
- Closes #6883.
2020-11-25 15:42:44 -08:00
John MacFarlane
e26d31d56b latex template: disable language-specific shorthands in babel.
Babel defines "shorthands" for some languages, and these can
produce unexpected results. For example, in Spanish, `1.22`
gets rendered as `122`, and `et~al.` as `etal`.

One would think that babel's `shorthands=off` option (which
we were using) would disable these, but it doesn't.  So we
remove `shorthands=off` and add some code that redefines
the shorthands macro.  Eventually this will be fixed in babel,
I hope, and we can revert to something simpler.

Closes #6817, closes #6887.
2020-11-25 08:25:30 -08:00
John MacFarlane
6b057d6d18 latex template: add a \break after parbox in CSLRightInline.
This should fix spacing problems between entries
with numeric styles.
2020-11-18 23:22:34 -08:00
John MacFarlane
356795dba0 latex template: fix number of params on CSLReferences. 2020-11-18 22:49:35 -08:00
John MacFarlane
b1a58a04fd LaTeX template: fix \CSLRightInline...
so that it does not run over the right margin.
2020-11-03 10:27:05 -08:00
John MacFarlane
bd7c9eb32b LaTeX writer: Improved calculation of table column widths.
We now have LaTeX do the calculation, using `\tabcolsep`.
So we should now have accurate relative column widths no
matter what the text width.

The default template has been modified to load the calc
package if tables are used.
2020-10-29 12:10:05 -07:00
Angelo Peronio
83b54bb0b3
Do not load amssymb if not needed (#6762)
Fixes #6469. From https://tex.stackexchange.com/a/549938
2020-10-19 16:15:32 -07:00
John MacFarlane
82280cc62c default.latex: fix CSLReference macro definition.
It improperly handled entry spacing and expected 3 parameters
instead of 2.
2020-10-13 10:09:19 -07:00
John MacFarlane
e0984a43a9 Add built-in citation support using new citeproc library.
This deprecates the use of the external pandoc-citeproc
filter; citation processing is now built in to pandoc.

* Add dependency on citeproc library.
* Add Text.Pandoc.Citeproc module (and some associated unexported
  modules under Text.Pandoc.Citeproc).  Exports `processCitations`.
  [API change]
* Add data files needed for Text.Pandoc.Citeproc:  default.csl
  in the data directory, and a citeproc directory that is just
  used at compile-time.  Note that we've added file-embed as a mandatory
  rather than a conditional depedency, because of the biblatex
  localization files. We might eventually want to use readDataFile
  for this, but it would take some code reorganization.
* Text.Pandoc.Loging: Add `CiteprocWarning` to `LogMessage` and use it
  in `processCitations`. [API change]
* Add tests from the pandoc-citeproc package as command tests (including
  some tests pandoc-citeproc did not pass).
* Remove instructions for building pandoc-citeproc from CI and
  release binary build instructions.  We will no longer distribute
  pandoc-citeproc.
* Markdown reader: tweak abbreviation support.  Don't insert a
  nonbreaking space after a potential abbreviation if it comes right before
  a note or citation.  This messes up several things, including citeproc's
  moving of note citations.
* Add `csljson` as and input and output format. This allows pandoc
  to convert between `csljson` and other bibliography formats,
  and to generate formatted versions of CSL JSON bibliographies.
* Add module Text.Pandoc.Writers.CslJson, exporting `writeCslJson`. [API
  change]
* Add module Text.Pandoc.Readers.CslJson, exporting `readCslJson`. [API
  change]
* Added `bibtex`, `biblatex` as input formats.  This allows pandoc
  to convert between BibLaTeX and BibTeX and other bibliography formats,
  and to generated formatted versions of BibTeX/BibLaTeX bibliographies.
* Add module Text.Pandoc.Readers.BibTeX, exporting `readBibTeX` and
  `readBibLaTeX`. [API change]
* Make "standalone" implicit if output format is a bibliography format.
  This is needed because pandoc readers for bibliography formats put
  the bibliographic information in the `references` field of metadata;
  and unless standalone is specified, metadata gets ignored.
  (TODO: This needs improvement. We should trigger standalone for the
  reader when the input format is bibliographic, and for the writer
  when the output format is markdown.)
* Carry over `citationNoteNum` to `citationNoteNumber`.  This was just
  ignored in pandoc-citeproc.
* Text.Pandoc.Filter: Add `CiteprocFilter` constructor to Filter.
  [API change] This runs the processCitations transformation.
  We need to treat it like a filter so it can be placed
  in the sequence of filter runs (after some, before others).
  In FromYAML, this is parsed from `citeproc` or `{type: citeproc}`,
  so this special filter may be specified either way in a defaults file
  (or by `citeproc: true`, though this gives no control of positioning
  relative to other filters).  TODO: we need to add something to the
  manual section on defaults files for this.
* Add deprecation warning if `upandoc-citeproc` filter is used.
* Add `--citeproc/-C` option to trigger citation processing.
  This behaves like a filter and will be positioned
  relative to filters as they appear on the command line.
* Rewrote the manual on citatations, adding a dedicated Citations
  section which also includes some information formerly found in
  the pandoc-citeproc man page.
* Look for CSL styles in the `csl` subdirectory of the pandoc user data
  directory.  This changes the old pandoc-citeproc behavior, which looked
  in `~/.csl`.  Users can simply symlink `~/.csl` to the `csl`
  subdirectory of their pandoc user data directory if they want
  the old behavior.
* Add support for CSL bibliography entry formatting to LaTeX, HTML,
  Ms writers.  Added CSL-related CSS to styles.html.
2020-09-21 10:15:50 -07:00
John MacFarlane
06d834caaa Use selnolig to selectively suppress ligatures with lualatex.
Closes #6534
2020-07-15 13:28:44 -07:00
Frederik Elwert
7716caaf2a
Make polyglossia package options list-aware in the LaTeX template. (#6444) 2020-06-14 10:38:02 -07:00
John MacFarlane
cef30e7384 LaTeX template: add space option to xeCJK with PassOptionsToPackage.
Otherwise we can get a clash with documentclasses that
already load the package.  Closes #6002.
2020-01-29 21:47:24 -08:00
Heiko Schlittermann
ea2c5152ec Allow framebreaks for beamer's TOC (#6012) 2019-12-27 10:58:36 -08:00
Yihui Xie
ee44d44f20 Keep the \author{} command even if author is not specified (#5961)
Otherwise there will be a LaTeX warning "No \author given" when the .tex file is compiled.
This does not affect spacing in the title block.
2019-12-05 10:22:31 -08:00
jeongminkim-islab
72666f3331 Patch for fixing spacing problem on CJK language. (#5855)
This changes the default on the xeCJK package so that spaces between words
are preserved instead of being collapsed. This is necessary for Korean.

Issue and solution is from below.
https://tex.stackexchange.com/questions/17292/how-to-write-spaces-between-korean-words-with-xecjk
2019-11-16 09:41:21 -08:00
John MacFarlane
4d5fd9e2fe Remove include of grffile from default latex template.
This package is needed for proper handling of image filenames
containing periods (in addition to the period before the
extension).

Unfortunately, grffile breaks in the latest texlive update.
Until a fix is released (see ho-tex/oberdiek#73) it seems best
to remove this from the default template.

This may cause problems if you have filenames with periods.
The workaround is to put `\usepackage{grffile}` in header-includes,
and be sure you're using an older version of texlive packages.

See #5848. We will leave that issue open to remind us to
check upstream, and restore grffile when it's possible to
do so.
2019-10-29 21:44:08 -07:00
John MacFarlane
e4638170d0 Further mod to hanging indent code in latex template.
Make sure the length is always defined.
2019-09-03 12:33:25 -07:00
John MacFarlane
dc01071053 Slight improvements to hanging indent code in latex template.
See jgm/pandoc-citeproc#410.
2019-09-03 12:30:40 -07:00
John MacFarlane
0fe635d3ec LaTeX writer: use cslreferences environment for csl bibliographies.
this allows bibliographies to receive special formatting.

The template now contains definition of this environment (enabled
only when CSL is used).

It also defines a `\cslhangindent` length.  This is set to
2em by default when the bibliography style specifies
a hanging indent.  To override the length, you can
use e.g.

\setlength{\cslhangindent}{7em}

in header-includes.

Closes jgm/pandoc-citeproc#410.
2019-09-02 22:14:00 -07:00
Daniel Maslowski
d286363f97 Fix using Beamer with geometry (#5505)
Beamer already loads geometry, so we need to use the `\geometry`
command to set geometry options.
2019-05-15 00:18:52 -04:00
John MacFarlane
6d19c08e9f LaTeX template: Add pdflang to hypersetup if lang is set.
Closes #5443.
2019-04-11 16:58:36 -07:00
Andrew Dunning
3d1409347a LaTeX template: Ensure correct heading/table order (#5421)
Improve the workaround for #1658, adapting a solution by @u-fischer in
<https://github.com/latex3/latex2e/issues/131> that works whether or not
the `indent` variable is enabled.

Remove `subparagraph` variable in LaTeX template.  The default is now
to use run-in style for level 4 and 5 headings (`\paragraph` and `\subparagraph`).
To get the previous default behavior (where these were formatted as blocks,
like `\subsubsection`), set the `block-headings` variable.

An example is given in the manual of reformatting the appearance of headings
more thoroughly using KOMA-Script.

Closes #5365.
2019-04-02 18:18:36 -06:00
Andrew Dunning
c21db81efd LaTeX template: Add pandoc to PDF metadata (#5388)
Credits pandoc in content creator metadata (the default is 'LaTeX with hyperref').
2019-03-25 22:36:14 -06:00
Andrew Dunning
e91af0a8a3 LaTeX template: Group graphics-related code (#5389)
* LaTeX template: Group graphics-related code

The default figure placement was added in <f3ab4bc2b9>; there does not appear to have been a reason for placing it at the end of the preamble.

* Update tests
2019-03-22 22:35:55 -06:00