summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/LaTeX.hs
Commit message (Collapse)AuthorAge
* Added support for translations (localization) (see #3559).John MacFarlane2017-08-11
| | | | | | | | | | | | | | | | | | | | | | | | | | * readDataFile, readDefaultDataFile, getReferenceDocx, getReferenceODT have been removed from Shared and moved into Class. They are now defined in terms of PandocMonad primitives, rather than being primitve methods of the class. * toLang has been moved from BCP47 to Class. * NoTranslation and CouldNotLoudTranslations have been added to LogMessage. * New module, Text.Pandoc.Translations, exporting Term, Translations, readTranslations. * New functions in Class: translateTerm, setTranslations. Note that nothing is loaded from data files until translateTerm is used; setTranslation just sets the language to be used. * Added two translation data files in data/translations. * LaTeX reader: Support `\setmainlanguage` or `\setdefaultlanguage` (polyglossia) and `\figurename`.
* LaTeX writer: Don't use figure inside table cell.John MacFarlane2017-08-06
| | | | Closes #3836.
* Make `papersize: a4` work regardless of the case of `a4`.John MacFarlane2017-06-28
| | | | It is converted to `a4` in LaTeX and `A4` in ConTeXt.
* LaTeX writer: fixed detection of otherlangs.John MacFarlane2017-06-28
| | | | | | We weren't recursing into inline contexts. Closes #3770.
* LaTeX writer: use BCP47 parser.John MacFarlane2017-06-26
|
* Writers: adjusted for renderTemplate' changes.John MacFarlane2017-06-20
| | | | Now we raise a proper error on template failure.
* Fixed footnotes in table captions.John MacFarlane2017-06-20
| | | | | | | | Note that if the table has a first page header and a continuation page header, the notes will appear only on the first occurrence of the header. Closes #2378.
* Use Control.Monad.State.Strict throughout.John MacFarlane2017-06-17
| | | | | This gives 20-30% speedup and reduction of memory usage in most of the writers.
* Switched Writer types to use Text.John MacFarlane2017-06-11
| | | | | | | | | | | * XML.toEntities: changed type to Text -> Text. * Shared.tabFilter -- fixed so it strips out CRs as before. * Modified writers to take Text. * Updated tests, benchmarks, trypandoc. [API change] Closes #3731.
* Shared: Provide custom isURI that rejects unknown schemes [isURI]Albert Krewinkel2017-05-23
| | | | | | | | | | | | | | | | | | | We also export the set of known `schemes`. The new function replaces the function of the same name from `Network.URI`, as the latter did not check whether a scheme is well-known. E.g. MediaWiki wikis frequently feature pages with names like `User:John`. These links were interpreted as URIs, thus turning internal links into global links. This is prevented by also checking whether the scheme of a URI is frequently used (i.e. is IANA registered or an otherwise well-known scheme). Fixes: #2713 Update set of well-known URIs from IANA list All official IANA schemes (as of 2017-05-22) are included in the set of known schemes. The four non-official schemes doi, isbn, javascript, and pmid are kept.
* Don't render LaTeX images with data: URIs.John MacFarlane2017-05-18
| | | | | | | LaTeX can't handle these. Note that --extract-media can be used when the input contains data: URIs. Closes #3636.
* Update dates in copyright noticesAlbert Krewinkel2017-05-13
| | | | | This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
* LaTeX writer: Fix problem with escaping in lstinline.John MacFarlane2017-04-29
| | | | | | | | | | | | | | | | | | Previously the LaTeX writer created invalid LaTeX when `--listings` was specified and a code span occured inside emphasis or another construction. This is because the characters `%{}\` must be escaped in lstinline when the listinline occurs in another command, otherwise they must not be escaped. To deal with this, adoping Michael Kofler's suggestion, we always wrap lstinline in a dummy command `\passthrough`, now defined in the default template if `--listings` is specified. This way we can consistently escape the special characters. Closes #1629.
* LaTeX writer: don't use lstinline it \item[..].John MacFarlane2017-04-28
| | | | | | | If you do, the contents of item disappear or are misplaced. Use `\texttt` instead. Closes #645.
* LaTeX writer: fix error with line breaks after empty content.John MacFarlane2017-04-25
| | | | | | | LaTeX requires something before a line break, so we insert a `~` if no printable content has yet been emitted. Closes #2874.
* Include \VerbatimFootnotes for highlighted code blocksTimm Albers2017-04-03
| | | | | | Updated the LaTeX writer to also include \VerbatimFootnotes in the preamble for highlighted code blocks. Previously this was only done for raw code blocks.
* Allow dynamic loading of syntax definitions.John MacFarlane2017-03-30
| | | | | | | | | | | | | | | | | See #3334. * Add writerSyntaxMap to WriterOptions. * Highlighting: added parameter for SyntaxMap to highlight. * Implemented --syntax-definition option. TODO: [ ] Figure out whether we want to have the xml parsing depend on the dtd (it currently does, and fails unless the language.dtd is found in the same directory). [ ] Add an option to read a KDE syntax highlighting theme as a custom style. [ ] Add tests.
* LaTeX/Beamer writer: allow hyperlinks to frames.John MacFarlane2017-03-16
| | | | | | | | | | | Previously you could link to a header above or below slide level but not TO slide level. This commit changes that. Hypertargets are inserted inside frame titles; technically the reference is to just after the title, but in normal use (where slides are viewed full screen in a slide show), this does not matter. Closes #3220.
* Highlighting: highlighting now returns an Either rather than Maybe.John MacFarlane2017-03-13
| | | | | | | This allows us to display error information returned by the skylighting library. Display a warning if the highlighting library throws an error.
* Stylish-haskell automatic formatting changes.John MacFarlane2017-03-04
|
* LaTeX writer: add `\leavevmode` before hypertarget at start of paragraph.John MacFarlane2017-03-02
| | | | | | | Closes #2704 (formatting problems in beamer citations). See http://tex.stackexchange.com/questions/22852/function-and-usage-of-leavevmode
* LaTeX writer: use % after hypertarget before code blockJohn MacFarlane2017-03-02
|
* LaTeX writer: minor tweak to hypertarget (semantically irrelevant).John MacFarlane2017-03-02
|
* LaTeX writer: always add hypertarget when there's a non-empty identifier.John MacFarlane2017-03-01
| | | | | Previously the hypertargets were only added when there was actually a link to that identifier. Closes #2719.
* Removed `\strut` at beginning of table cells.John MacFarlane2017-02-23
| | | | | | | This fixes a problem with alignment of lists in table cells (closes #3436). The `\strut` at the end seems to be enough to avoid the too-close spacing that motivated addition of the strut in #1573.
* Added warnings for non-rendered blocks to some writers.John MacFarlane2017-02-17
|
* Handle language in inline code with --listings.John MacFarlane2017-02-05
| | | | Closes #3422.
* LaTeX writer: export writeBeamer.John MacFarlane2017-01-28
| | | | Removed writerBeamer from WriterOptions.
* Removed writerHighlight; made writerHighlightStyle a Maybe.John MacFarlane2017-01-25
| | | | | | API change. For no highlighting, set writerHighlightStyle to Nothing.
* Revert "Added page breaks into Pandoc."John MacFarlane2017-01-25
| | | | This reverts commit f02a12aff638fa2339192231b8f601bffdfe3e14.
* Removed writerIgnoreNotes.John MacFarlane2017-01-25
| | | | | | | | | Instead, just temporarily remove notes when generating TOC lists in HTML and Markdown (as we already did in LaTeX). Also export deNote from Text.Pandoc.Shared. API change in Shared and Options.WriterOptions.
* Removed writerTeXLigatures.John MacFarlane2017-01-25
| | | | | | Make `smart` extension work in LaTeX/ConTeXt writers instead. Instead of `-t latex --no-tex-ligatures`, do `-t latex-smart`.
* Convert all writers to use PandocMonad.Jesse Rosenthal2017-01-25
| | | | | | | | | | | | | | | Since PandocMonad is an instance of MonadError, this will allow us, in a future commit, to change all invocations of `error` to `throwError`, which will be preferable for the pure versions. At the moment, we're disabling the lua custom writers (this is temporary). This requires changing the type of the Writer in Text.Pandoc. Right now, we run `runIOorExplode` in pandoc.hs, to make the conversion easier. We can switch it to the safer `runIO` in the future. Note that this required a change to Text.Pandoc.PDF as well. Since running an external program is necessarily IO, we can be clearer about using PandocIO.
* Adds support for pagebreaks (when it makes sense)Hubert Plociniczak2017-01-25
| | | | | | | Update all writers to take into account page breaks. A straightforwad, far from complete, implementation of page breaks in selected writers. Readers will have to follow in the future as well.
* Updates to use skylighting rather than highlighting-kate.John MacFarlane2016-12-23
| | | | | | | | So far this just reproduces capacity. Later we'll be able to add features like warning messages, dynamic loading of xml syntax definitions, and dynamic loading of themes.
* LaTeX writer: allow tables with empty cells to count as "plain."John MacFarlane2016-12-16
| | | | | | | This addresses a problem of too-wide tables when empty cells are used. Thanks to Joost Kremers for reporting the issue.
* LaTeX writer: Fix unnumbered headers when used with `--top-level`Albert Krewinkel2016-12-04
| | | | | | | | Fix interaction of top-level divisions `part` or `chapter` with unnumbered headers when emitting LaTeX. Headers are ensured to be written using stared commands (like `\subsection*{}`). Fixes: #3272
* Options: Removed writerStandalone, made writerTemplate a Maybe.John MacFarlane2016-11-30
| | | | | | | | Previously setting writerStandalone = True did nothing unless a template was provided in writerTemplate. Now a fragment will be generated if writerTemplate is Nothing; otherwise, the specified template will be used and standalone output generated. [API change]
* Refactor top-level division selection (#3261)Albert Krewinkel2016-11-27
| | | | | | | | | | | | | | The "default" option is no longer represented as `Nothing` but via a new type constructor, making the `Maybe` wrapper superfluous. The default behavior of using heuristics can now be enabled explicitly by setting `--top-level-division=default`. API change (`Text.Pandoc.Options`): The `Division` type was renamed to `TopLevelDivision`. The `Section`, `Chapter`, and `Part` constructors were renamed to `TopLevelSection`, `TopLevelChapter`, and `TopLevelPart`, respectively. An additional `TopLevelDefault` constructor was added, which is now also the new default value of the `writerTopLevelDivision` field in `WriterOptions`.
* [Tex] Remove invalid inlines in sections (#3218)hubertp-lshift2016-11-26
| | | | | | | | | | | Latex doesn't like when hypertargets or images are put in the options list of the section. They are not lost since they were actually duplicated and present also in the second argument list. Note on the implementation: I had to inline the definiton of 'foldMap' since it is not implemented in every version of Haskell that Pandoc supports.
* Allow to overwrite top-level division type heuristics (#3258)Albert Krewinkel2016-11-26
| | | | | | | | | | | | | Pandoc uses heuristics to determine the most resonable top-level division type when emitting LaTeX or Docbook markup. It is now possible to overwrite this implicitly set top-level division via the `top-level-division` command line parameter. API change (`Text.Pandoc.Options`): the type of the `writerTopLevelDivision` field in of the `WriterOptions` data type is altered from `Division` to `Maybe Division`. The field's default value is changed from `Section` to `Nothing`. Closes: #3197
* LaTeX writer: use `\autocites*` when "suppress-author" citation used.John MacFarlane2016-11-24
|
* LaTeX writer: ensure that simple tables have simple cells.John MacFarlane2016-11-20
| | | | | | | If cells contain more than a single Plain or Para, then we need to set nonzero widths and put contents into minipages. Closes #2666.
* Add option for top-level division typeAlbert Krewinkel2016-10-19
| | | | | | | | | | The `--chapters` option is replaced with `--top-level-division` which allows users to specify the type as which top-level headers should be output. Possible values are `section` (the default), `chapter`, or `part`. The formats LaTeX, ConTeXt, and Docbook allow `part` as top-level division, TEI only allows to set the `type` attribute on `div` containers. The writers are altered to respect this option in a sensible way.
* Add --parts command line option to LaTeX writer.Oliver Matthews2016-09-06
| | | | | | | Add --parts command line argument. This only effects LaTeX writer, and only for non-beamer output formats. It changes the output levels so the top level is 'part', the next 'chapter' and then into sections.
* Add support for the LineBlock element to writersAlbert Krewinkel2016-10-13
| | | | | | | | | | | | | | | | | The following markup features are used to output the lines of the `LineBlock` element: - AsciiDoc: a `[verse]` block, - ConTeXt: text surrounded by `\startlines` and `\endlines`, - HTML: `div` with an per-element style setting to interpret the content as pre-wrapped, - Markdown: line blocks if the `line_blocks` extension is enabled, a simple paragraph with hard linebreaks otherwise, - Org: VERSE block, - RST: a line block, and - all other formats: a paragraph, containing hard linebreaks between lines. Custom lua writers should be updated to use the `LineBlock` element.
* Merge pull request #3093 from wilx/master-figure-placementJohn MacFarlane2016-09-28
|\ | | | | LaTeX: Do not set [htbp] figure placement options.
| * LaTeX: Do not set [htbp] figure placement options.Vaclav Zeman2016-08-29
| | | | | | | | | | | | Do not set `[htbp]` placement options on each figure to allow overriding them by them using `\fps@figure` redefintion either in header or in template.
* | LaTeX writer: change braced backtick to \textasciigrave{}Jesse Rosenthal2016-09-20
| | | | | | | | | | | | | | Backticks in verbatim environments are converted to open-single-quotes. This change makes them appear as backticks. This corresponds to how we treat `'' in verbatim environments (with \textquotesingle{}).
* | LaTeX writer: enclose backtick in `{}` in verbatimJesse Rosenthal2016-09-19
| | | | | | | | | | | | | | We don't want ligatures like ` ?` ` (which produces `¿`) inside `\texttt{}` environments, so we enclose the backtick in braces. This fixes #3121