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

Markdown to Latex (PDF) #2395

Closed
frafor opened this issue Sep 14, 2015 · 6 comments
Closed

Markdown to Latex (PDF) #2395

frafor opened this issue Sep 14, 2015 · 6 comments

Comments

@frafor
Copy link

frafor commented Sep 14, 2015

When doing Markdown to LaTeX (for PDF) transformation, we see that if what is requested is the documentclass book, then the numeric index is formed starting with Chapter 0 and ending with Chapter 0, as if ALL sections were from chapter zero.

This is because you are tranforming the new ONE-POUNT (#, or h1) as section instead of chapter when the documentclass is book.

If documentclass is article, then, fine: h1 h2 etc become sections; but LaTeX demands that h1 becomes Chapter title when a book is generated from a quite a long markdown text, with h1 (#) symbols considered Chapter's titles.

Please, review this; it works perfectly ok when generating an ePub book, but it fails because the Pandoc transformation mechanism or machine is not considering the type of documentclass (book) that is being generated in the LaTeX for PDF machine.

@jgm
Copy link
Owner

jgm commented Sep 14, 2015

You can use the --chapters command-line option to make
level-1 headers be treated as chapters.

Pandoc will look at the template and do this automatically
if you have documentclass{book}. Or, at least, it should --
perhaps some special feature of your setup is preventing
this from working. But the most reliable method is to
use --chapters explicitly.

+++ Franz J Fortuny L de M [Sep 13 15 21:18 ]:

When doing Markdown to LaTeX (for PDF) transformation, we see that if
what is requested is the documentclass book, then the numeric index is
formed starting with Chapter 0 and ending with Chapter 0, as if ALL
sections were from chapter zero.

This is because you are tranforming the new ONE-POUNT (#, or

   ) as section instead of chapter when the documentclass is book.

If documentclass is article, then, fine: h1 h2 etc become sections; but
LaTeX demands that h1 becomes Chapter title when a book is generated
from a quite a long markdown text, with h1 (#) symbols considered
Chapter's titles.

Please, review this; it works perfectly ok when generating an ePub
book, but it fails because the Pandoc transformation mechanis is not
considering the type of documentclass that is being generated in the
LaTeX for PDF machine.


Reply to this email directly or [1]view it on GitHub.

References

  1. Markdown to Latex (PDF) #2395

@frafor
Copy link
Author

frafor commented Sep 14, 2015

Well, the documentclass is set to book in the yaml section of.the markdown
file and it does honor all other parameters also explicitly mentioned, such
as geometry margins and binding space, etc. And it generates a latex with
sections and chapter zero.

Ok I will try the --chapters option.

Was this modified recently? I installed it from Ubuntu and it is the
latest they have at that source. I tried to update and apt reported nothing
to change or add.

El 14/09/2015 00:41, "John MacFarlane" notifications@github.com escribió:

You can use the --chapters command-line option to make
level-1 headers be treated as chapters.

Pandoc will look at the template and do this automatically
if you have documentclass{book}. Or, at least, it should --
perhaps some special feature of your setup is preventing
this from working. But the most reliable method is to
use --chapters explicitly.

+++ Franz J Fortuny L de M [Sep 13 15 21:18 ]:

When doing Markdown to LaTeX (for PDF) transformation, we see that if
what is requested is the documentclass book, then the numeric index is
formed starting with Chapter 0 and ending with Chapter 0, as if ALL
sections were from chapter zero.

This is because you are tranforming the new ONE-POUNT (#, or

) as section instead of chapter when the documentclass is book.

If documentclass is article, then, fine: h1 h2 etc become sections; but
LaTeX demands that h1 becomes Chapter title when a book is generated
from a quite a long markdown text, with h1 (#) symbols considered
Chapter's titles.

Please, review this; it works perfectly ok when generating an ePub
book, but it fails because the Pandoc transformation mechanis is not
considering the type of documentclass that is being generated in the
LaTeX for PDF machine.


Reply to this email directly or [1]view it on GitHub.

References

  1. Markdown to Latex (PDF) #2395


Reply to this email directly or view it on GitHub
#2395 (comment).

@jgm
Copy link
Owner

jgm commented Sep 14, 2015

Yes, the current code checks the template directly;
it doesn't check the documentclass metadata field.
(This code dates from before YAML metadata.)
But we could change it to check this too.

Ubuntu tends to have old versions of pandoc in the
repository. You might consider using the deb package
I provide instead, for an up-to-date version.

+++ Franz J Fortuny L de M [Sep 14 15 07:43 ]:

Well, the documentclass is set to book in the yaml section of.the
markdown
file and it does honor all other parameters also explicitly mentioned,
such
as geometry margins and binding space, etc. And it generates a latex
with
sections and chapter zero.
Ok I will try the --chapters option.
Was this modified recently? I installed it from Ubuntu and it is the
latest they have at that source. I tried to update and apt reported
nothing
to change or add.
El 14/09/2015 00:41, "John MacFarlane" notifications@github.com
escribió:

You can use the --chapters command-line option to make
level-1 headers be treated as chapters.

Pandoc will look at the template and do this automatically
if you have documentclass{book}. Or, at least, it should --
perhaps some special feature of your setup is preventing
this from working. But the most reliable method is to
use --chapters explicitly.

+++ Franz J Fortuny L de M [Sep 13 15 21:18 ]:

When doing Markdown to LaTeX (for PDF) transformation, we see that
if
what is requested is the documentclass book, then the numeric index
is
formed starting with Chapter 0 and ending with Chapter 0, as if ALL
sections were from chapter zero.

This is because you are tranforming the new ONE-POUNT (#, or

) as section instead of chapter when the documentclass is book.

If documentclass is article, then, fine: h1 h2 etc become sections;
but
LaTeX demands that h1 becomes Chapter title when a book is
generated
from a quite a long markdown text, with h1 (#) symbols considered
Chapter's titles.

Please, review this; it works perfectly ok when generating an ePub
book, but it fails because the Pandoc transformation mechanis is
not
considering the type of documentclass that is being generated in
the
LaTeX for PDF machine.


Reply to this email directly or [1]view it on GitHub.

References

  1. Markdown to Latex (PDF) #2395


Reply to this email directly or view it on GitHub
#2395 (comment).


Reply to this email directly or [1]view it on GitHub.

References

  1. Markdown to Latex (PDF) #2395 (comment)

@frafor
Copy link
Author

frafor commented Sep 14, 2015

I did make the changes and it works OK.

Do you check for the language of the book being printed, so that things
like "Table of Contents" and "Chapters" become whatever the language of the
book demands?

On Mon, Sep 14, 2015 at 11:05 AM, John MacFarlane notifications@github.com
wrote:

Yes, the current code checks the template directly;
it doesn't check the documentclass metadata field.
(This code dates from before YAML metadata.)
But we could change it to check this too.

Ubuntu tends to have old versions of pandoc in the
repository. You might consider using the deb package
I provide instead, for an up-to-date version.

+++ Franz J Fortuny L de M [Sep 14 15 07:43 ]:

Well, the documentclass is set to book in the yaml section of.the
markdown
file and it does honor all other parameters also explicitly mentioned,
such
as geometry margins and binding space, etc. And it generates a latex
with
sections and chapter zero.
Ok I will try the --chapters option.
Was this modified recently? I installed it from Ubuntu and it is the
latest they have at that source. I tried to update and apt reported
nothing
to change or add.
El 14/09/2015 00:41, "John MacFarlane" notifications@github.com
escribió:

You can use the --chapters command-line option to make
level-1 headers be treated as chapters.

Pandoc will look at the template and do this automatically
if you have documentclass{book}. Or, at least, it should --
perhaps some special feature of your setup is preventing
this from working. But the most reliable method is to
use --chapters explicitly.

+++ Franz J Fortuny L de M [Sep 13 15 21:18 ]:

When doing Markdown to LaTeX (for PDF) transformation, we see that
if
what is requested is the documentclass book, then the numeric index
is
formed starting with Chapter 0 and ending with Chapter 0, as if ALL
sections were from chapter zero.

This is because you are tranforming the new ONE-POUNT (#, or

) as section instead of chapter when the documentclass is book.

If documentclass is article, then, fine: h1 h2 etc become sections;
but
LaTeX demands that h1 becomes Chapter title when a book is
generated
from a quite a long markdown text, with h1 (#) symbols considered
Chapter's titles.

Please, review this; it works perfectly ok when generating an ePub
book, but it fails because the Pandoc transformation mechanis is
not
considering the type of documentclass that is being generated in
the
LaTeX for PDF machine.


Reply to this email directly or [1]view it on GitHub.

References

  1. Markdown to Latex (PDF) #2395


Reply to this email directly or view it on GitHub
#2395 (comment).


Reply to this email directly or [1]view it on GitHub.

References

  1. Markdown to Latex (PDF) #2395 (comment)


Reply to this email directly or view it on GitHub
#2395 (comment).

@jgm
Copy link
Owner

jgm commented Sep 14, 2015

There's a template variable for this, which must be set in
a specific way. The plan is to make this work in a uniform
way for all formats, with a lang variable that takes
standardized values, but I haven't had a chance to work on
this lately. Soon, I hope.

+++ Franz J Fortuny L de M [Sep 14 15 09:19 ]:

I did make the changes and it works OK.
Do you check for the language of the book being printed, so that things
like "Table of Contents" and "Chapters" become whatever the language of
the
book demands?

@jgm
Copy link
Owner

jgm commented Sep 15, 2015

TODO: check the documentclass metadata variable in addition to the template, when looking for book classes.

@jgm jgm closed this as completed in da1b599 Sep 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants