jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.2k stars 3.36k forks source link

{.unnumbered} tag cannot work at level 4 or lower? #6018

Closed bsnresearcher closed 4 years ago

bsnresearcher commented 4 years ago

Do you have any idea to solve this?

I want to disappear the section number on the level4 of headline.

The un-numbering command {-} or {.unnumberd} can work expectedly as follows below figures.

However the number on the level4- of headline did not disappear unexpectedly.

Level4 or lower{-}

\ This {-} of this section did not work.


- output(test.pdf)
![image](https://user-images.githubusercontent.com/34906909/71551697-76506b00-2a30-11ea-9e3a-3fa4499310d3.png)

- cmd: `pandoc test.md -s -o test.pdf -N -F pandoc-crossref --pdf-engine=lualatex -V documentclass=ltjsarticle -V luatexjapresetoption=ms`
- pandoc: v2.9.1

P.S This pdf was produced by vscode-pandec addon @ VSCode
jgm commented 4 years ago

Please explain what you mean "cannot work." What command did you try with this input? What output did you get? What did you expect? What version of pandoc?

mb21 commented 4 years ago

Can you try without pandoc-crossref? Is it only when using luatex?

bsnresearcher commented 4 years ago

Pandoc-crossref, Pandoc-citeproc and so on are in requirement. The unexpected result occurred at upLatex too. I tried without the crossref filter but the result was same. Thank you.

jgm commented 4 years ago

OK, reproduced this with simply

 pandoc 6018.md  --number-sections -o 6018.pdf

where 6018.md is

### Level3 or higher{-}
The {-} of this section work well.

#### Level4 or lower{-}
\
This {-} of this section did not work.
jgm commented 4 years ago

With level-3 headers, we use latex \subsection, or for unnumbered subsections the variant \subsection*. But it seems that with level-4 sections, \paragraph is used for both numbered and unnumbered. Looks like there actually is a \paragraph* command which we should use.

bsnresearcher commented 4 years ago

Thank you, jgm. If you have any method to change a command \paragraph of LaTeX to \paragraph* inside Markdown file, tell me please.

T-o-m-H-u commented 1 year ago

@jgm

block-headings: true seems to break paragraph and subparagraph. The star ends up in the wrong place. --number-sections is implied.

block-headings

---
secnumdepth: 5
block-headings: true

...

# numbered section
fine

# unnumbered section {-}
fine too

#### numbered paragraph
right

#### unnumbered paragraph {-}
star ending up in wrong place
ofabel commented 7 months ago

@T-o-m-H-u is indeed true.

A temporary solution to this problem is set block-headings to false and add the following code snippet to the header section (use include-in-header):

% Make \paragraph and \subparagraph free-standing
\let\oldparagraph\paragraph
\let\oldsubparagraph\subparagraph

\makeatletter

\renewcommand{\paragraph}{
  \@ifstar
    \xxxParagraphStar
    \xxxParagraphNoStar
}
\renewcommand{\subparagraph}{
  \@ifstar
    \xxxSubParagraphStar
    \xxxSubParagraphNoStar
}

\newcommand{\xxxParagraphStar}[1]{\oldparagraph*{#1}\mbox{}}
\newcommand{\xxxParagraphNoStar}[1]{\oldparagraph{#1}\mbox{}}

\newcommand{\xxxSubParagraphStar}[1]{\oldsubparagraph*{#1}\mbox{}}
\newcommand{\xxxSubParagraphNoStar}[1]{\oldsubparagraph{#1}\mbox{}}

\makeatother
jgm commented 7 months ago

@T-o-m-H-u or @ofabel

block-headings: true seems to break paragraph and subparagraph.

Please create a new issue for this.