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

Change h_heading to also scan toc title #227

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

torik42
Copy link
Owner

@torik42 torik42 commented Aug 15, 2022

This is the continuation of #196 after the transfer. Old discussion:

@torik42:

So far only the directly printed title of the commands \section and similar are checked. It would be nice if also the title for the table of contents given as an optional argument, i.e. \section[Short Title]{Long Title} would be checked.

My suggestion is to put it in the output as is done for the usual title, i.e. \section[a]{b} would be parsed as a. b. . The whitespace in the end even has the advantage that \section{Title}Some text will not yield a mistake any more.

Since there are a lot of tests, I did not adapt them yet. If you agree to the proposed changes, @matze-dd, I could do so.

@torik42:

One could maybe even make the addition of the dot a function by its own. This would make it easier to use it in other packages as well. I will need a similar thing in the beamer class, for example.

Something like

def append_dot(parser, toks):
    txt = parser.get_text_expanded(toks).strip()
    if (txt and parser.parms.heading_punct
            and txt[-1] not in parser.parms.heading_punct):
        toks.append(TextToken(toks[-1].pos, '.'))
    toks.append(SpaceToken(toks[-1].pos, ' '))

@torik42 torik42 added the type: LaTeX Issues concerning supported or new LaTeX command or packages label Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: LaTeX Issues concerning supported or new LaTeX command or packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant