Skip to content

Commit

Permalink
Merge pull request #10788 from albert-github/feature/issue_10147
Browse files Browse the repository at this point in the history
issue #10147 Generating pdf with LuaLateX
  • Loading branch information
doxygen committed Apr 11, 2024
2 parents a21c4cc + ef7c101 commit fcf9e32
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/formula.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ void FormulaManager::createLatexFile(const QCString &fileName,Format format,Mode
{
TextStream t(&f);
t << "\\documentclass{article}\n";
t << "\\usepackage{iftex}\n";
t << "\\usepackage{ifthen}\n";
t << "\\usepackage{epsfig}\n"; // for those who want to include images
t << "\\usepackage[utf8]{inputenc}\n"; // looks like some older distributions with newunicode package 1.1 need this option.
Expand Down
7 changes: 5 additions & 2 deletions src/latexgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ static void writeMakeBat()
term("Could not open file %s for writing\n",qPrint(fileName));
}
t << "pushd %~dp0\r\n";
t << "if not %errorlevel% == 0 goto :end\r\n";
t << "if not %errorlevel% == 0 goto :end1\r\n";
t << "\r\n";
t << "set ORG_LATEX_CMD=%LATEX_CMD%\r\n";
t << "set ORG_MKIDX_CMD=%MKIDX_CMD%\r\n";
Expand Down Expand Up @@ -581,6 +581,7 @@ static void writeMakeBat()
t << "@echo Please consult %MANUAL_FILE%.log to see the error messages\r\n";
t << "@echo ===============\r\n";
t<< "\r\n";
t<< ":end\r\n";
t<< "@REM reset environment\r\n";
t<< "popd\r\n";
t<< "set LATEX_CMD=%ORG_LATEX_CMD%\r\n";
Expand All @@ -594,7 +595,7 @@ static void writeMakeBat()
t<< "set LATEX_COUNT=%ORG_LATEX_COUNT%\r\n";
t<< "set ORG_LATEX_COUNT=\r\n";
t<< "\r\n";
t<< ":end\r\n";
t<< ":end1\r\n";
#endif
}

Expand Down Expand Up @@ -2318,6 +2319,7 @@ void writeLatexSpecialFormulaChars(TextStream &t)
sup3[1]= 0xB3;
sup3[2]= 0;

t << "\\ifpdftex\n";
t << "\\usepackage{newunicodechar}\n";
// taken from the newunicodechar package and removed the warning message
// actually forcing to redefine the unicode character
Expand All @@ -2341,6 +2343,7 @@ void writeLatexSpecialFormulaChars(TextStream &t)
" \\doxynewunicodechar{" << sup2 << "}{${}^{2}$}% Superscript two\n"
" \\doxynewunicodechar{" << sup3 << "}{${}^{3}$}% Superscript three\n"
"\n";
t << "\\fi\n";
}

void filterLatexString(TextStream &t,const QCString &str,
Expand Down
41 changes: 32 additions & 9 deletions templates/latex/header.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
% to overcome problems with too many open files
\let\mypdfximage\pdfximage\def\pdfximage{\immediate\mypdfximage}
\pdfminorversion=7
\RequirePackage{iftex}
\ifluatex
\directlua{pdf.setminorversion(7)}
\fi
\ifxetex
\special{pdf:minorversion 7}
\fi
\ifpdftex
\pdfminorversion=7
\fi
% Set document class depending on configuration
%%BEGIN COMPACT_LATEX
Expand Down Expand Up @@ -33,14 +42,22 @@
\let\protected@wlog\@@protected@wlog
\makeatother
\IfFormatAtLeastTF{2016/01/01}{}{\usepackage{fixltx2e}} % for \textsubscript
\IfFormatAtLeastTF{2015/01/01}{\pdfsuppresswarningpagegroup=1}{}
\ifpdftex
\IfFormatAtLeastTF{2015/01/01}{\pdfsuppresswarningpagegroup=1}{}
\fi
\usepackage{doxygen}
$extralatexstylesheet

\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\iftutex
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\usepackage{unicode-math}
\else
\usepackage[utf8]{inputenc}
\fi
\usepackage{makeidx}
\PassOptionsToPackage{warn}{textcomp}
\usepackage{textcomp}
Expand All @@ -53,7 +70,10 @@
% Define default fonts
% Font selection
%%BEGIN LATEX_FONTENC
\usepackage[$latexfontenc]{fontenc}
\iftutex
\else
\usepackage[$latexfontenc]{fontenc}
\fi
%%END LATEX_FONTENC

% set main and monospaced font
Expand Down Expand Up @@ -167,16 +187,19 @@
% Hyperlinks
%%BEGIN PDF_HYPERLINKS
% Hyperlinks (required, but should be loaded last)
\ifpdf
\usepackage[pdftex,pagebackref=true,unicode,psdextra]{hyperref}
\ifpdftex
\usepackage[pdftex,pagebackref=true]{hyperref}
\else
\ifxetex
\usepackage[pagebackref=true]{hyperref}
\usepackage[xetex,pagebackref=true]{hyperref}
\else
\usepackage[ps2pdf,pagebackref=true]{hyperref}
\ifluatex
\usepackage[luatex,pagebackref=true]{hyperref}
\else
\usepackage[ps2pdf,pagebackref=true]{hyperref}
\fi
\fi
\fi
\hypersetup{%
colorlinks=true,%
linkcolor=blue,%
Expand Down

0 comments on commit fcf9e32

Please sign in to comment.