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

Using breakafterinrun to break long sequences of dashes in tutorial #294

Closed
muzimuzhi opened this issue Sep 28, 2024 · 9 comments
Closed
Assignees

Comments

@muzimuzhi
Copy link
Contributor

In tcolorbox-tutorial-poster.pdf, page 13 (the last page)

  • current
    image
  • proposed
    image
    diff --git a/doc/latex/tcolorbox/tcolorbox-tutorial-poster.tex b/doc/latex/tcolorbox/tcolorbox-tutorial-poster.tex
    index ebc9b4e..13ea843 100644
    --- a/doc/latex/tcolorbox/tcolorbox-tutorial-poster.tex
    +++ b/doc/latex/tcolorbox/tcolorbox-tutorial-poster.tex
    @@ -1373,7 +1373,7 @@ Our poster is finished now. Just go to the next page to see the final result.
         \tcbinputlisting{standard jigsaw,size=minimal,toprule=0.5mm,bottomrule=0.5mm,boxsep=2mm,
           colback=white,opacityback=0.75,listing only,
           enforce breakable,tcb@poster@boxheight,before skip=-\interlineskip,height fixed for=all,
    -      minted options={tabsize=2,fontsize=\small,breaklines,breakafter={\,\]-}},
    +      minted options={tabsize=2,fontsize=\small,breaklines,breakafter={\,\]-},breakafterinrun},
           listing file=tcolorbox-example-poster.tex}%
       }
     \end{tcbposter}

Related: gpoore/fvextra#27

@muzimuzhi
Copy link
Contributor Author

muzimuzhi commented Sep 28, 2024

BTW minted v3 doesn't need shell escape anymore.

% arara: pdflatex: { shell: yes }
% arara: pdflatex: { shell: yes }

minted v3 ships with a new script/executable latexminted(.py) which is auto trusted by TeX Live since TeX Live r72375. This can be verified in stdout of tlmgr conf texmf shell_escape_commands or kpsewhich -var-value shell_escape_commands.

PS: If collection-latexextra is not installed, one need to run tlmgr install --reinstall minted to install the new binary. See https://tug.org/pipermail/tex-live/2024-September/050859.html for more info.

@T-F-S
Copy link
Owner

T-F-S commented Sep 30, 2024

Thank you. I will breakafterinrun.

BTW I had major problems with minted v3 during package building and finally switched to minted2

  • latexmk never stopped, because *.index.minted changed constantly. I tried to construct a MWE, but could not find a reliable one to communicate (works sometimes, sometimes not).
  • Umlauts did not work with minted v3 (had this problem with the csvsimple package)

@T-F-S T-F-S self-assigned this Sep 30, 2024
@muzimuzhi
Copy link
Contributor Author

  • latexmk never stopped, because *.index.minted changed constantly.

Is it a simple latexmk tcolorbox.tex or with some customized config? I thought that tcolorbox docs were compiled via arara.

@T-F-S
Copy link
Owner

T-F-S commented Sep 30, 2024

Is it a simple latexmk tcolorbox.tex or with some customized config? I thought that tcolorbox docs were compiled via arara.

I used a manual script and later arara to build the documentation, but it became too complex to figure out the needed number of compiler runs. So, I switched to latexmk some time ago to savely automate the needed reruns.

I made a MWE which does not need tcolorbox to fail with minted:

% !TeX encoding=UTF-8
\documentclass{article}
%\usepackage{minted2}
\usepackage{minted}
%\usepackage[minted]{tcolorbox}

\begin{document}

Test

\begin{minted}{tex}
Hello \textbf{world}
\end{minted}

%\begin{tcblisting}{}
%Hello \textbf{world}
%\end{tcblisting}

\end{document}

My .latexmkrc file is

$pdf_mode = 4;        # tex -> pdf mit lualatex
$lualatex = 'pdflatex -synctex=1 -interaction=batchmode -shell-escape';
$max_repeat = 16;

This is nearly identical to my tcolorbox setup where the increase of max_repeat is needed.

The problem with the MWE is that it does not fail every time. Minutes ago, I tried from vanilla several times (no fail), removed *.fdb_latexmk, compiled a single pdflatex, etc. to finally get the fail:

grafik

This is a endless loop which stops with error after 16 reruns.

The more complex tcolorbox documentation always fails, but a (successfull) creation with latexmk takes about 30 minutes - and experimenting here already cost me too much time. Therefore, I went back to minted2 which works without problems.

BTW I also searched the latexmk documention for some config to ignore *.index.minted, which may circumvent the problem, but found nothing (or missed to understand).

@muzimuzhi
Copy link
Contributor Author

muzimuzhi commented Sep 30, 2024

Minutes ago, I tried from vanilla several times (no fail), removed *.fdb_latexmk, compiled a single pdflatex, etc. to finally get the fail:

On my side, after a manual single pdflatex, then latexmk always resulted in an endless loop.

The culprit is the timestamp stored in *.index.minted which is accurate to the second. The .latexmkrc below worked for me:

$pdf_mode = 4;        # tex -> pdf mit lualatex
$lualatex = 'pdflatex -synctex=1 -interaction=batchmode -shell-escape';
$max_repeat = 4;

# when calculating hashes for '.minted' files, ignore lines matching pattern '"timestamp":'
$hash_calc_ignore_pattern{'minted'} = '"timestamp":';

It seems hash_calc_ignore_pattern cannot handle double extensions, as both of hash_calc_ignore_pattern('index.minted') and hash_calc_ignore_pattern('index\.minted') didn't work.

*.index.minted is a new minted aux file (created by the corresponding latexminted python package and containing a json object) since v3, thus there's little info about it across other docs.

I think this deserves to be reported to minted (to share the trick with latexmk and see if that's the only pattern to ignore) and also latexmk (as its example rc file for minted v2.x now needs an update).

@T-F-S
Copy link
Owner

T-F-S commented Oct 1, 2024

$hash_calc_ignore_pattern{'minted'} = '"timestamp":';

Thank you - this seems to be exactly what I was looking for. I cannot test before the weekend, but this looks good!

@gpoore
Copy link

gpoore commented Oct 2, 2024

I think that the issue with the *.index.minted is that it is being updated more than necessary. I'm working on finalizing the next minted release, and I will change things so that the index file is no longer replaced unless the data it contains has changed.

gpoore added a commit to gpoore/minted that referenced this issue Oct 2, 2024
…ain is modified, fixing compatibility with build tools (T-F-S/tcolorbox/issues/294); fixed a bug that could prevent a cache from being fully cleaned when it is shared by multiple documents
@muzimuzhi
Copy link
Contributor Author

  • latexmk never stopped, because *.index.minted changed constantly. I tried to construct a MWE, but could not find a reliable one to communicate (works sometimes, sometimes not).

Should be fixed in latexminted python package, v0.2.0.

  • Umlauts did not work with minted v3 (had this problem with the csvsimple package)

Probably similar to gpoore/minted#411 thus also fixed in latexminted v0.2.0.

@T-F-S
Copy link
Owner

T-F-S commented Oct 22, 2024

@T-F-S T-F-S closed this as completed Oct 22, 2024
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

3 participants