se2p / se2thesis

A Thesis Class for the Chair of Software Engineering II at the University of Passau, Germany
https://ctan.org/pkg/se2thesis
LaTeX Project Public License v1.3c
11 stars 3 forks source link

Java comments in `minted` produce warnings #6

Closed tomFellner closed 10 months ago

tomFellner commented 10 months ago

When using the minted package and writing comments, for example in Java, as shown in this example

\documentclass[%
  chapterprefix=false,%
  open=right,%
  twoside=false,%
  paper=a4,%
  logofile={logo.png},%
  thesistype=bachelorproposal,%
  UKenglish,%
]{se2thesis}
\listfiles
\usepackage[ngerman,main=UKenglish]{babel}

\usepackage[%
  minted=true,%
]{se2packages}

\begin{document}

\begin{listing}[ht]
    \begin{minted}{java}
  public class LectureTest {
    // here is some comment
  }
  \end{minted}
\end{listing}

\end{document}

the following warning is generated:

[...]
LaTeX Font Warning: Font shape `T1/zi4/m/it' undefined
(Font)              using `T1/zi4/m/n' instead on input line 3.
[...]
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
[...]

After some research I stumbled upon the following suggestion: https://tex.stackexchange.com/a/224262

my workaround consists currently by setting the following block in the preamble:

\makeatletter
% there's no italic/slanted for Inconsolata
\@namedef{T1/zi4/m/it}{<->ssub*zi4/m/n}
\@namedef{T1/zi4/b/it}{<->ssub*zi4/b/n}
\@namedef{T1/zi4/bx/it}{<->ssub*zi4/b/n}
\@namedef{T1/zi4/m/sl}{<->ssub*zi4/m/n}
\@namedef{T1/zi4/b/sl}{<->ssub*zi4/b/n}
\@namedef{T1/zi4/bx/sl}{<->ssub*zi4/b/n}
\makeatother

It may be a good practice to implement this workaround in the se2packages itself.

stephanlukasczyk commented 10 months ago

Thanks for the report. Since this is actually an issue of the included font package, I've referenced this issue from there and close this one.

stephanlukasczyk commented 9 months ago

FYI, @tomFellner : I've just release version 0.4 of the inconsolata-nerd-font package, which fixes this issue. It is already available from GitHub; I've also submitted it to CTAN but it will take a couple of days until you'll have the update available from there or via the TeX Live/MikTeX updater.

tomFellner commented 9 months ago

Thank you for the new version of inconsolata-nerd-font.

Just for documentation: To work correctly I had to move from pdflatex to lualatex. I did so by changing my .latexmkrc:

#!/bin/env perl
# See https://texdoc.org/serve/latexmk/0
-$pdf_mode = 1;
+$pdf_mode = 4;
$postscript_mode = $dvi_mode = 0;

set_tex_cmds( '-synctex=1 -file-line-error --shell-escape %O %S' );
$hash_calc_ignore_pattern{aux} = '^\\\\gdef\\\\minted@oldcachelist\{,'.
                                 '|^\s*default\.pygstyle,'.
                                 '|^\s*[[:xdigit:]]+\.pygtex';

This removed the warnings:

LaTeX Font Warning: Some font shapes were not available, defaults substituted.
stephanlukasczyk commented 9 months ago

Just for documentation: To work correctly I had to move from pdflatex to lualatex.

You want to use LuaLaTeX anyway, because it's the new hot shit :joy: The TrueType/OpenType fonts from the Inconsolata Nerd Font would only work correctly if one uses LuaLaTeX (or XeLaTeX); pdfLaTeX does not support these types of fonts, thus it would use the fallback to Inconsolata, which does not support the italic variant.