Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LaTeX reader - pandoc ignores \part #1905

Closed
ousia opened this issue Jan 27, 2015 · 8 comments
Closed

LaTeX reader - pandoc ignores \part #1905

ousia opened this issue Jan 27, 2015 · 8 comments

Comments

@ousia
Copy link
Contributor

ousia commented Jan 27, 2015

Converting the following LaTeX code:

\part{Part}

\chapter{Chapter}

\section{Section}

in markdown format gives the following code:

\part{Part}

Chapter
=======

Section
-------

\part is ignored.

I wonder whether it would make sense to convert it to # Part {.part} or to enable a --part option in pandoc.

@juh2
Copy link

juh2 commented Jan 27, 2015

I would vote for a --part option in pandoc as \part is a LaTeX only feature. But +1 for this enhancement. It would be great to have this option.

When converting from markdown to latex/pdf with the option --part a top level headine becomes a \part in the latex source.

@ousia
Copy link
Contributor Author

ousia commented Jan 28, 2015

I have just realized that a --parts option makes sense when writing LaTeX documents, not when reading them.

@mpickering
Copy link
Collaborator

I'm not sure what the best way to support this is.

@loindutroupeau
Copy link

'part' also exists in epub (at least in epub3). Indeed, it would be great to have a correspondance with the latex command \part.

@ousia
Copy link
Contributor Author

ousia commented Nov 15, 2015

@mpickering, wouldn’t it be possible to implement --parts in a similar way --chapters has been implemented?

@ickc
Copy link
Contributor

ickc commented Oct 20, 2016

Hi, I stumbled upon the same issue today. As I used to MultiMarkdown's behavior, I thought setting --base-header-level=0 would solve the problem: that level 1-6 markdown headings becomes level 0-5 LaTeX headings. But there's an error. Searching the pandoc-discuss results in this: --base-header-level= - Google Groups. And then searching in GitHub issue tracker results in this issue.

It seems mapping level 1-6 markdown headings to level 0-5 LaTeX headings is natural. In terms of command line option, from markdown to LaTeX should accept --base-header-level=0 to trigger this behavior.

Currently, from LaTeX to Markdown seems to map LaTeX 1-5 to Markdown 1-5, when no option or --base-header-level=1 is used. So following this logic, it seems --base-header-level=2 should map LaTeX 0-5 to Markdown 1-6. This way, backward compatibility issue is minimize, since if it is left as default, the part, having level 0, would not be mapped to a markdown heading at level 0.

@jgm
Copy link
Owner

jgm commented Feb 22, 2017

We have a --top-level-division option now. I suppose we could set things up so that the LaTeX reader parsed \part as a section header if that is set. Alternatively, we could have it always
parse \part as a section header (automatically bumping up chapter to level 2, section to level 3, etc.).

@jgm jgm added this to the pandoc 2.0 milestone Mar 9, 2017
@jgm jgm closed this as completed in 6bf3f89 Mar 13, 2017
@rauschma
Copy link

rauschma commented Feb 1, 2018

--top-level-division=part works well, but there are two problems:

  • Numbering doesn’t work. For example, --number-sections now numbers chapters in HTML.

    • It’d be great if everything down to and including sections could be numbered in HTML. But that’s relatively complex: continuing chapter numbers across parts, different numbering for chapters in the front matter, etc.
  • The TOC isn’t formatted properly. You still get nested ULs.

However, if you can live without numbered chapters, there is much you can do via CSS:

nav#TOC ul {
    list-style: none;
}

nav#TOC > ul > li {
    margin-top: 1em;
}
nav#TOC > ul > li > ul {
    margin-top: 1em;
}
nav#TOC > ul > li > a {
    margin-top: 4em;
    text-transform: uppercase;
}
nav#TOC > ul > li > ul > li {
    margin-top: 0.5em;
}
nav#TOC > ul > li > ul > li > a {
    font-weight: bold;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants