#StackBounty: #luatex #fontspec #unicode-math #inconsolata unicode-math: Font "Inconsolata" has no glyph for mathhyphen. How…

Bounty: 200

Compile the following MWE with LuaLaTeX

documentclass{article}

usepackage{libertinus}
% Set the same teletype font for text, mathtt and symtt
setmonofont{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase]
setmathtt{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase]
setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up},Scale=MatchLowercase]

% I hoped the following line would do the trick, but it only triggers a compilation error
% setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up,"2010->"002D},Scale=MatchLowercase]

begin{document}
begin{tabular}{lcc}hline
                                & texttt{textbackslash mathhyphen}  &  normal texttt{-} \hline
texttt{textbackslash mathrm}  &  $mathrm{initmathhyphen cmd}$  &  $mathrm{init-cmd}$ \
texttt{textbackslash mathsf}  &  $mathsf{initmathhyphen cmd}$  &  $mathsf{init-cmd}$ \
texttt{textbackslash mathit}  &  $mathit{initmathhyphen cmd}$  &  $mathit{init-cmd}$ \
texttt{textbackslash mathtt}  &  $mathtt{initmathhyphen cmd}$  &  $mathtt{init-cmd}$ \hline
end{tabular}
end{document}

The result is

result

Note the missing hyphen for the teletype math font.

The log says

Missing character: There is no ‐ (U+2010) in font [Inconsolatazi4-Regular.otf]:mode=base;script=latn;language=DFLT;+tlig;!

This is understandable, because unicode-math maps the Latin teletype symbols from the 1D4xxx range to the ASCII range and takes the glyphs from Inconsolata. (Note the range=tt->up option of setmathfont) This re-mapping seems to fail for the hyphen.

However, the font Inconsolata contains a glyph for the hyphen at position 002D. If the normal hyphen is input, this glyph is used but with the spacing of a binary operator.

I hoped the line

setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up,"2010->"002D},Scale=MatchLowercase]

would do the trick, but it doesn’t.

How can I tell fontspec to use the same glyph as a math hyphen and apply the correct spacing?


Get this bounty!!!

#StackBounty: #luatex #fontspec #unicode-math #inconsolata unicode-math: Font "Inconsolata" has no glyph for mathhyphen. How…

Bounty: 200

Compile the following MWE with LuaLaTeX

documentclass{article}

usepackage{libertinus}
% Set the same teletype font for text, mathtt and symtt
setmonofont{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase]
setmathtt{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase]
setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up},Scale=MatchLowercase]

% I hoped the following line would do the trick, but it only triggers a compilation error
% setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up,"2010->"002D},Scale=MatchLowercase]

begin{document}
begin{tabular}{lcc}hline
                                & texttt{textbackslash mathhyphen}  &  normal texttt{-} \hline
texttt{textbackslash mathrm}  &  $mathrm{initmathhyphen cmd}$  &  $mathrm{init-cmd}$ \
texttt{textbackslash mathsf}  &  $mathsf{initmathhyphen cmd}$  &  $mathsf{init-cmd}$ \
texttt{textbackslash mathit}  &  $mathit{initmathhyphen cmd}$  &  $mathit{init-cmd}$ \
texttt{textbackslash mathtt}  &  $mathtt{initmathhyphen cmd}$  &  $mathtt{init-cmd}$ \hline
end{tabular}
end{document}

The result is

result

Note the missing hyphen for the teletype math font.

The log says

Missing character: There is no ‐ (U+2010) in font [Inconsolatazi4-Regular.otf]:mode=base;script=latn;language=DFLT;+tlig;!

This is understandable, because unicode-math maps the Latin teletype symbols from the 1D4xxx range to the ASCII range and takes the glyphs from Inconsolata. (Note the range=tt->up option of setmathfont) This re-mapping seems to fail for the hyphen.

However, the font Inconsolata contains a glyph for the hyphen at position 002D. If the normal hyphen is input, this glyph is used but with the spacing of a binary operator.

I hoped the line

setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up,"2010->"002D},Scale=MatchLowercase]

would do the trick, but it doesn’t.

How can I tell fontspec to use the same glyph as a math hyphen and apply the correct spacing?


Get this bounty!!!

#StackBounty: #luatex #fontspec #unicode-math #inconsolata unicode-math: Font "Inconsolata" has no glyph for mathhyphen. How…

Bounty: 200

Compile the following MWE with LuaLaTeX

documentclass{article}

usepackage{libertinus}
% Set the same teletype font for text, mathtt and symtt
setmonofont{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase]
setmathtt{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase]
setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up},Scale=MatchLowercase]

% I hoped the following line would do the trick, but it only triggers a compilation error
% setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up,"2010->"002D},Scale=MatchLowercase]

begin{document}
begin{tabular}{lcc}hline
                                & texttt{textbackslash mathhyphen}  &  normal texttt{-} \hline
texttt{textbackslash mathrm}  &  $mathrm{initmathhyphen cmd}$  &  $mathrm{init-cmd}$ \
texttt{textbackslash mathsf}  &  $mathsf{initmathhyphen cmd}$  &  $mathsf{init-cmd}$ \
texttt{textbackslash mathit}  &  $mathit{initmathhyphen cmd}$  &  $mathit{init-cmd}$ \
texttt{textbackslash mathtt}  &  $mathtt{initmathhyphen cmd}$  &  $mathtt{init-cmd}$ \hline
end{tabular}
end{document}

The result is

result

Note the missing hyphen for the teletype math font.

The log says

Missing character: There is no ‐ (U+2010) in font [Inconsolatazi4-Regular.otf]:mode=base;script=latn;language=DFLT;+tlig;!

This is understandable, because unicode-math maps the Latin teletype symbols from the 1D4xxx range to the ASCII range and takes the glyphs from Inconsolata. (Note the range=tt->up option of setmathfont) This re-mapping seems to fail for the hyphen.

However, the font Inconsolata contains a glyph for the hyphen at position 002D. If the normal hyphen is input, this glyph is used but with the spacing of a binary operator.

I hoped the line

setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up,"2010->"002D},Scale=MatchLowercase]

would do the trick, but it doesn’t.

How can I tell fontspec to use the same glyph as a math hyphen and apply the correct spacing?


Get this bounty!!!

#StackBounty: #luatex #fontspec #unicode-math #inconsolata unicode-math: Font "Inconsolata" has no glyph for mathhyphen. How…

Bounty: 200

Compile the following MWE with LuaLaTeX

documentclass{article}

usepackage{libertinus}
% Set the same teletype font for text, mathtt and symtt
setmonofont{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase]
setmathtt{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase]
setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up},Scale=MatchLowercase]

% I hoped the following line would do the trick, but it only triggers a compilation error
% setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up,"2010->"002D},Scale=MatchLowercase]

begin{document}
begin{tabular}{lcc}hline
                                & texttt{textbackslash mathhyphen}  &  normal texttt{-} \hline
texttt{textbackslash mathrm}  &  $mathrm{initmathhyphen cmd}$  &  $mathrm{init-cmd}$ \
texttt{textbackslash mathsf}  &  $mathsf{initmathhyphen cmd}$  &  $mathsf{init-cmd}$ \
texttt{textbackslash mathit}  &  $mathit{initmathhyphen cmd}$  &  $mathit{init-cmd}$ \
texttt{textbackslash mathtt}  &  $mathtt{initmathhyphen cmd}$  &  $mathtt{init-cmd}$ \hline
end{tabular}
end{document}

The result is

result

Note the missing hyphen for the teletype math font.

The log says

Missing character: There is no ‐ (U+2010) in font [Inconsolatazi4-Regular.otf]:mode=base;script=latn;language=DFLT;+tlig;!

This is understandable, because unicode-math maps the Latin teletype symbols from the 1D4xxx range to the ASCII range and takes the glyphs from Inconsolata. (Note the range=tt->up option of setmathfont) This re-mapping seems to fail for the hyphen.

However, the font Inconsolata contains a glyph for the hyphen at position 002D. If the normal hyphen is input, this glyph is used but with the spacing of a binary operator.

I hoped the line

setmathfont{Inconsolatazi4-Regular.otf}[range={tt/{latin,Latin}->up,"2010->"002D},Scale=MatchLowercase]

would do the trick, but it doesn’t.

How can I tell fontspec to use the same glyph as a math hyphen and apply the correct spacing?


Get this bounty!!!

#StackBounty: #luatex #latexmk #compilation-error Random errors while compiling a large document with LuaLaTeX via Latexmk

Bounty: 50

I’m working on a rather large (200 pages) document.

Once or twice a day, I get a compile error which references a line that does not exist in my code. That is, the line does exist, but the error references contents that are slightly different from what the file actually contains.

The last such error was:

! Undefined control sequence.
l.166 subsecction
                {Max-Pooling}

Line 166 of file experiments.tex contains that exact line, but without the double c and the newline:

subsection{Max-Pooling}

I’m using the continuous option of Latexmk. On failure, it automatically recompiles just fine after that error, without me having to change a file (!). If I clean the build dir and then rebuild, no such error occurs. I’ve configured Latexmk with a $failure_cmd that prints the tail of the log and so catched the eror, but I haven’t been able to catch full the log.

This is not a showstopper for me since on a recompile the error always goes away: however it’s quite disturbing. I’m at a loss as to how to provide more info.

I can’t share the full document and wouldn’t know how to provide a MWE for this issue, since it is not a deterministic error.

These are the packages I’ve loaded. I’ve also mounted the $out_dir to a RAM drive. I am using the book class and LuaLaTeX/Latexmk, on Kubuntu, TeX Live package:

texlive/cosmic,cosmic,now 2018.20180824-1 all TexLive


Get this bounty!!!

#StackBounty: #luatex How to customize novel class?

Bounty: 100

I have to to customize a file written with Novel class. I’d need to add a table of contents and modify SetRectoHeadText{} in order to have the current chapter name. How could I do that?

This is my MWE:

% !TeX TS-program = LuaLaTeX
% !TeX encoding = UTF-8
documentclass{novel} % See list of class options; usually none needed.
%%% METADATA (FILE DATA):
usepackage[frenchb]{babel}
usepackage{lipsum}
SetTitle{My title} % Required for PDF/X.
SetSubtitle{My subtitle} % Default: empty.
SetAuthor{My name} % Default: empty.
SetApplication{LuaLaTeX with novel and microtype}
SetProducer{LuaLaTeX with novel-pdfx and hyperref}
SetPDFX[CGATSTR001]{X-1a:2001}
%%% DIMENSIONS:
SetTrimSize{5.5in}{8.5in} % Sets width, height of your book.
% Default Media Size equals Trim Size.
% Rarely-used over-ride, except for cover artwork:
% SetMediaSize[alignment]{width}{height}
% Default margins vary with Trim Size. Defaults for {5.5in}{8.5in}:
SetMargins{0.80in}{0.80in}{0.80in}{0.80in}
%%% GENERAL FONTS:
% Percent at end of line is necessary, when writing font settings multi-line:
SetParentFont[%
SmallCapsFeatures={Renderer=Basic},% Effective when small caps requested locally.
Kerning=On, %
Ligatures=TeX, %
]{Libertinus Serif}
% Main text font automatically adds Numbers=OldStyle,Ligatures=Common.
% Default main font size is based on other layout settings.
% Varies from 11pt to 12pt. With all default layouts, value is 11.4pt.
% You may manually choose a different main font size:
% SetFontSize{length}
% Default lines per page (main textblock) is calculated from other layout settings.
% When using all defaults, the calculated value is 35.
% If used, SetLinesPerPage manually chooses the value:
% SetLinesPerPage{integer}
SetDecoFont{NovelDeco.otf}
setsansfont{Libertinus Sans}
setmonofont{Libertinus Mono}
setmathfont{Libertinus Math} % unicode-math
%%% HEADERS/FOOTERS:
SetHeadFootStyle{1} % This style has headers only.
SetHeadJump{2}
SetFootJump{2}
SetLooseHead{50}
SetEmblems{}{} % Default blanks.
SetHeadFont[parentfontfeatures,Letters=SmallCaps,Scale=0.92]{parentfontname}
SetPageNumberStyle{thepage}
SetVersoHeadText{theTitle}
SetRectoHeadText{theSubtitle}
%%% CHAPTERS:
SetChapterStartStyle{footer} % Equivalent to empty, when style has no footer.
SetChapterStartHeight{7}
SetChapterFont[Numbers=Lining,Scale=1.6]{parentfontname}
SetSubchFont[Numbers=Lining,Scale=1.2]{parentfontname}
SetScenebreakIndent{false}
%%% CUSTOM FONTS:
% NewFontFamily[]{} % Optional command.
% NewFontFace[]{} % Optional command.
% CreateFontFeature{}{} % Optional command.
%%% OTHER:
%setdefaultlanguage[variant=american]{english} % polyglossia
microtypesetup{config=novel-microtype,stretch=20,shrink=20,final} % microtype
%%% BEGIN DOCUMENT:
begin{document}
frontmatter % Sets page number to i.
mainmatter % Sets page number to 1 for following material.mainmatter % Required
% Chapters go here. SAMPLE Chapter structure:
clearpage % or cleartorecto
begin{ChapterStart}
vspace*{2nbs} % Space above chapter title. nbs = normal baseline skip.
ChapterTitle{A title} % Perhaps also ChapterSubtitle, ChapterDeco.
end{ChapterStart}
lipsum

end{document}


Get this bounty!!!

#StackBounty: #luatex #latexmk #dependencies latexmk: "file not found" even though custom dependency should add it

Bounty: 50

I am working on a large document, that contains descriptions of several technical components. I have written several macros that trigger the automatic creation of “.uml” files during a lualatex-compilation of the document.
Afterwards, these files may be passed to plantUml, which then creates nice “.png” pictures, that can afterwards be included into the document. All of this works fine.

However, I now wish to automate this process so that creation and inclusion of the diagrams doesn’t require two different calls of lualatex and possibly the addition of “includegraphics{}” in the “.tex”-files.

For this purpose I try to use latexmk with the configuration:

$pdflatex = 'lualatex %O %S ';
$pdf_mode = 1;
$postscript_mode = $dvi_mode = 0;

add_cus_dep('glo', 'gls', 0, 'run_makeglossaries');
add_cus_dep('acn', 'acr', 0, 'run_makeglossaries');
add_cus_dep('uml', 'png', 0, 'uml2png');

sub uml2png {
    system( "java -cp plantuml.jar  net.sourceforge.plantuml.Run -failfast2 -nbtread auto -charset UTF-8 -o . -v -tpng "$_[0].uml" "$_[0].png"" );
}

sub run_makeglossaries {
    if ( $silent ) {
        system( "makeglossaries -q "$_[0]"" );
    }
    else {
        system( "makeglossaries -q "$_[0]"" );
    };
}

push @generated_exts, 'uml', 'png';
push @generated_exts, 'glo', 'gls', 'glg';
push @generated_exts, 'acn', 'acr', 'alg';

$clean_ext .= ' %R.ist %R.xdy';

Now, when I try to include “graph.png” that can be computed from “graph.uml” which will be created at the end of the first run of lualatex on the document latexmk aborts telling me that this file is non-existant.

Why is this happening? If I understood the documentation of latexmk correctly, this case should be handled by passing “0” as must-argument to add_cus_dep(from, to, must, conv).

Of course, when I create the required “uml” files in advance they are converted correctly and there are no errors but this lacks automation. Calling lualatex -interaction=nonstopmode also works, but is not an option either.

Can you help me with another solution or explanation of that behaviour?

Thanks in advance.

EDIT:
I solved the problem by checking if the uml-files already exist (using IfFileExists), i.e. by postponing the inclusion of the generated graphics:

newcommand{generateDiagram}[1]{%
IfFileExists{%
    #1.uml%
    }{%
    begin{figure}%
        includegraphics[width=textwidth]{#1.png}%
    end{figure}%
    }{%
    typeout{Error. No file #1.}%
}%
}%

In the second run the custom dependency is then resolved correctly and the required pictures are created from the .uml-files.

The problem I am now facing is that latexmk seems to be unable to resolve my custom dependency if the files are not stored in the main directory. More precisely I have the following structure:

MAIN
|- FOO (uml goes here)
|- BAR 

I adjusted my add_cus_dep so that the data is read from MAIN/FOO and stored in MAIN/BAR.
Now, suppose there is a pic.uml which is generated in the first run and should be included in the second by generateDiagram{pic}. Latexmk stops and tells me that pic.png doesn’t exist (of course it doesn’t), without even looking at the dependencies.
Can you tell me where I go wrong?


Get this bounty!!!

#StackBounty: #luatex #fontspec #font-encodings Map all ASCII characters in document to Nemeth Braille

Bounty: 100

My goal is to type regular LaTeX input, and remap the fonts to produce Nemeth Braille. One answer to the question LaTeX to Braille
was to download the font http://www.searchfreefonts.com/free/braille.htm . This doesn’t work for me because this font doesn’t map (by default) ASCII characters the same way as Nemeth Braille. For instance using that font, 0 and 9 become ⠔ and ⠯ instead of ⠴ and ⠔ respectively.
Furthermore, in any case I’d like to be able to map, in some cases, an individual ASCII character to a pair of Braille characters.

I tried using the font handling features of luatex to make substitutions. They didn’t seem to have any effect for the font mentioned in the answer above, but they did for DejaVu.

Here’s what I tried:

% -*- TeX-engine: luatex; -*-
documentclass{article}
usepackage[no-math]{fontspec}

directlua{
fonts.handlers.otf.addfeature {
    name = "braille",
    type = "substitution", 
    data = {
      ["a"] = "⠁", ["b"] = "⠃", ["c"] = "⠉",
      % etc. all the way to z
      ["A"] = {"⠠","⠁"}, ["B"] = {"⠠","⠃"},
      ["C"] = {"⠠","⠉"}, % etc. all the way to Z
    }}}        


directlua{
fonts.handlers.otf.addfeature {
    name = "combos",
    type = "multiple", 
    data = {
      ["="] = {" ","⠨","⠅"," "}, 
      ["X"] = {"⠠","⠭"}, 
      ["Y"] = {"⠠","⠽"},
    }}}

setmainfont{DejaVu Sans}[RawFeature=+braille;+combos]
usepackage{mathastext}

begin{document}
abc = ABC = XY 

$abc = ABC = XY$  % should be identical to previous line
end{document}

Output:

Output of MWE

What still doesn’t work: (1) The font feature of type substitution doesn’t let me replace one character of input with two characters of output (or I don’t know how to make it do this). So A, B, and C are incorrect in both lines. (2) The font feature of type multiple does allow one input go to two output characters, but it’s not inherited by the math fonts using the mathastext package (or I don’t know how to make it do this). So =, X and Y are incorrect in the math line.

Does anyone know how to get the remapping to work for either DejaVu or the Braille font mentioned above?


Get this bounty!!!

#StackBounty: #luatex #linux LuaLatex Rendering from input buffer instead of filename

Bounty: 50

I am trying to create pdf by passing buffer instead of filename but have certain issues.PDF size is only limited to two pages and can include only two pictures.Following is the full scenario.

md

I have managed to complete step 1 and 2 and to render I have to save data in temporary tex file before giving to lualatex file.

Issue

  1. On passing tex Buffer (which is very large) I get too long argument in lualatex system call.It works with less data.
  2. Is step 4 possible ?
    Are there any alternatives.

Basically I am trying to minimize unencrypted files created in this process due to security reasons.


Get this bounty!!!

#StackBounty: #luatex #svg svg output and LuaTeX

Bounty: 200

Trying to find some ways to automate generation of svg output for TeX math formulas, I thought about two possibilities with luatex.

  1. Use lua inside a callback to parse the node tree and output svg (someone had the very idea some time ago).

  2. Use luatex itself to generate svg instead of pdf. As far as I can see, cairo library is included in luatex source code and cairo can output svg.

My questions are:

  1. What is the current status of svg output support with luatex (the program itself or “third parties” projects).
  2. Could I use mplib‘s metapost svg output for that matter? EDIT It seems that mplib does not support svg anymore.


Get this bounty!!!