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

Word "true" rendered at the end of some elements #446

Closed
l0th3r opened this issue Jun 10, 2024 · 7 comments
Closed

Word "true" rendered at the end of some elements #446

l0th3r opened this issue Jun 10, 2024 · 7 comments
Assignees
Labels
bug defaults Related to default option values and renderer prototypes latex Related to the LaTeX interface and implementation
Milestone

Comments

@l0th3r
Copy link

l0th3r commented Jun 10, 2024

Hi, I am really new to Tex, LaTex and LuaTex.

While rendering a list in markdown. The word "true" is rendered under the titles.

Do you have any idea what it is that could cause this word to be rendered ?
Thank you in advance for the help.

Markdown file content:

## TITLE
1. **ELEMENT**
    1. Element
    2. Element
    3. Element
2. **ELEMENT**
    1. Element
    2. Element
3. **ELEMENT**
    1. Element
    2. Element
4. **ELEMENT**
    1. Element
    2. Element
    3. Element
5. **ELEMENT**
    1. Element
    2. Element

PDF render:
Screenshot from 2024-06-10 14-48-41

@Witiko
Copy link
Owner

Witiko commented Jun 11, 2024

Hello again! This seems strange, can you please share your .tex document here?

@l0th3r
Copy link
Author

l0th3r commented Jun 14, 2024

Hi @Witiko sorry to have taken so long to answer.

Here is the .tex file:

\documentclass{article}

\usepackage{framed} % package to frame content in boxes
\usepackage{geometry} % package for custom page layout
\usepackage{setspace} % package for different spaces
\usepackage{fancyhdr} % package for custom header and footer
\usepackage{lastpage} % package for getting last page
\usepackage{graphicx} % package to import graphics
\usepackage{hyperref} % package to use hypertext references
\usepackage{fontspec} % package to use custom fonts
\usepackage{tabularx} % package to use custom tables
\usepackage{multirow} % package to combine rows in table
\usepackage{markdown} % package to parse markdown
\usepackage{verbatim} % package to sanatize text
\usepackage{titlesec} % package to change section titles
\usepackage[table]{xcolor} % package to use colors w/table

% uncomment to debug document geometry
%\geometry{showframe}

% define page size, orientation, include header and footer in computation
\geometry{a4paper, portrait, includehead, includefoot}
\geometry{headheight=97pt, headsep=10mm}
% define page margins
\geometry{tmargin=5mm, lmargin=20mm, rmargin=20mm, bmargin=10mm, nomarginpar}

% define graphics path
\graphicspath{{./}{content/}}

% set main font
\setmainfont{OpenSans}

% style for hypertext
\hypersetup{
	colorlinks=true,
	linkcolor=blue,
	filecolor=cyan,
	urlcolor=cyan
}
\urlstyle{same}

% override section title style
\titleformat{\section}
{\filcenter\bfseries\Large}
{\thesection.}{0.5em}{}

% markdown settings
\markdownSetup{
	blankBeforeCodeFence=true, 	% add blank space before code blocks
	fencedCode=true,				% allow code blocks
	fancyLists=true,				% allow more ways to create lists
	texMathDollars=true,			% allow Tex dollar sign mathematical expression
	inlineNotes=true,			% allow inline notes
	pipeTables=true,				% allow markdown tables
	taskLists=true,				% allow task lists
	underscores=false,			% remove usage of underscores for emphasis
}

% override markdown image generation
\global\def\markdownRendererImage#1#2#3#4{
	\begin{center}
		\includegraphics[width=0.5\textwidth]{#2}
	\end{center}
}

\global\def\markdownRendererLink#1#2#3#4{
  \href{#2}{#1}
}

\title{\documentget{title}}
\author{\companyget{name}}

\begin{document}
%------------
% Content
%------------
\catcode`\$=12
\catcode`\&=12
\catcode`\#=12
\catcode`\^=12
\catcode`\_=12
\catcode`\~=12
\catcode`\%=12
\clearpage

\markdownInput{temp.md}

\end{document}

Of course It's a sample document to remove what is not useful. This is why I have so much package (I left them in case one can be part of the problem.

The markdown file temp.md

## TITLE
1. **ELEMENT**
    1. Element
    2. Element
    3. Element
2. **ELEMENT**
    1. Element
    2. Element
3. **ELEMENT**
    1. Element
    2. Element
4. **ELEMENT**
    1. Element
    2. Element
    3. Element
5. **ELEMENT**
    1. Element
    2. Element

PDF result:
image

Thank you again for your time !

@Witiko
Copy link
Owner

Witiko commented Jun 14, 2024

@l0th3r Thanks for taking the time to post the example document. It exposes a bug in the default definitions for lists.

Here is a patch that you may include in your document below \usepackage{markdown} to fix the bug:

\ExplSyntaxOn
\markdownSetup{
  rendererPrototypes = {
    fancyOlBeginTight = {
      \group_begin:
      \tl_set:Nn
        \l__markdown_latex_fancy_list_item_label_number_style_tl
        { #1 }
      \tl_set:Nn
        \l__markdown_latex_fancy_list_item_label_delimiter_style_tl
        { #2 }
      \__markdown_if_option:nTF
        { startNumber }
        {
          \tl_set:Nn
            \l_tmpa_tl
            { \begin{compactenum} }
        }
        {
          \tl_set:Nn
            \l_tmpa_tl
            { \begin{compactenum}[ }
          \tl_put_right:Nx
            \l_tmpa_tl
            { \__markdown_latex_paralist_style:nn { #1 } { #2 } }
          \tl_put_right:Nn
            \l_tmpa_tl
            { ] }
        }
      \tl_put_left:Nn
        \l_tmpa_tl
        {
          \plpartopsep=\partopsep
          \pltopsep=\topsep
        }
      \tl_use:N
        \l_tmpa_tl
    },
  },
}
\ExplSyntaxOff

I fixed the bug in commit f978e81. Therefore, you can remove the patch from your document after you have installed version 3.7.0, which should appear in TeX Live later this month.

@Witiko Witiko closed this as completed Jun 14, 2024
@Witiko Witiko self-assigned this Jun 14, 2024
@Witiko Witiko added this to the 3.7.0 milestone Jun 14, 2024
@Witiko Witiko added bug defaults Related to default option values and renderer prototypes latex Related to the LaTeX interface and implementation labels Jun 14, 2024
@l0th3r
Copy link
Author

l0th3r commented Jun 14, 2024

Thank you @Witiko for your reactivity and implication !

@l0th3r
Copy link
Author

l0th3r commented Sep 5, 2024

@Witiko I allow myself to comment here because after updating the markdown package in 3.7.0 and removing the manual fix you provided, the problem still remains with the fancyList option. Is this expected ?

The markdown.lua file, to be sure of the markdown package version:
image

@Witiko
Copy link
Owner

Witiko commented Sep 5, 2024

@l0th3r Have you updated the whole markdown package, including the file markdownthemewitiko_markdown_defaults.sty?

@l0th3r
Copy link
Author

l0th3r commented Sep 5, 2024

@Witiko I have, but my update script copied them into a sub folder so the tex file was not importing the default.sty file. It's on me.

Thank you for your time and answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug defaults Related to default option values and renderer prototypes latex Related to the LaTeX interface and implementation
Projects
None yet
Development

No branches or pull requests

2 participants