This short document:
\documentclass[a4paper]{report}
\usepackage{gnu}
\begin{document}
\end{document}
with the following package:
%!TEX encoding = UTF-8 Unicode
\def\fileversion{2.7}
\def\filedate{%
Tue 2014-07-22
}
\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\typeout{Package 'mworx' (\filedate).}
\ProvidesPackage{gnu}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=mworx,prefix=mw@,setkeys=\setkeys}
\newif\if@read\@readfalse
\newif\if@grave\@gravefalse
\DeclareBoolOption[true]{greek}
\DeclareVoidOption{ifgrave}{\@gravetrue}
\DeclareVoidOption{read}{\@readtrue}
\DeclareBoolOption[true]{save}
\DeclareBoolOption[false]{inpenc}
\DeclareBoolOption[false]{pack}
\DeclareBoolOption[true]{rootsyst}
\DeclareBoolOption[true]{loop}
\DeclareBoolOption[true]{fnsect}
\DeclareBoolOption[false]{fonts}
\DeclareBoolOption[false]{ptmx}
\DeclareBoolOption[true]{bb}
\DeclareBoolOption[true]{misc}
\DeclareBoolOption[true]{lengths}
\DeclareBoolOption[true]{dps}
\DeclareBoolOption[true]{xtras}
\DeclareBoolOption[true]{thm}
\DeclareBoolOption[true]{block}
\DeclareBoolOption[true]{mathdel}
\DeclareBoolOption[true]{mwmath}
\DeclareBoolOption[true]{oper}
\DeclareBoolOption[true]{mathsymb}
\ProcessKeyvalOptions*\relax
%Option "fonts"
\ifmw@fonts
\RequirePackage{ifxetex,ifluatex}
\newif\ifengineright\enginerightfalse%Define new if to check if luatex or xetex are being used. To avoid typing the xetex/luatex commands twice.
\ifengineright %Add those commands
\setmathrm{Times New Roman}
\setmathsf{Times New Roman}
\setmathtt{Times New Roman}
\setboldmathrm[BoldFont={Optima ExtraBlack}]{Optima Bold}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{Times New Roman}
\setsansfont{Times New Roman}
\setmonofont{Helvetica}
\newfontfamily{\vrb}{Helvetica}
\newfontfamily{\Ak}{Akkadian}%
\newfontfamily{\mapu}{Arial Unicode MS}
\newfontfamily{\Ar}{Geeza Pro}
\newfontfamily{\Chs}{STSong}
\newfontfamily{\Cht}{PMingLiU}
\newfontfamily{\Ja}{MS Mincho}
\newfontfamily{\Ru}{Times New Roman}
\newfontfamily{\Gr}{Times New Roman}
\newfontfamily{\He}{Times New Roman}
\newfontfamily{\Ko}{Batang}
\newfontfamily{\Ind}{Devanagari MT}
\newfontfamily{\Mal}{Malayalam MN}
\newfontfamily{\Sinh}{Free Sans}
\newfontfamily{\Thai}{Free Serif}
\newcommand{\€}{\Gr{ }}
\else
{}
\fi
%More commands that are OK in any engine I know of.
\newcommand{\mbold}{\mathbf}
\newcommand{\tbold}{\textbf}
\newcommand{\ital}{\textit}
\newcommand{\CAPS}{\textsc}
\newcommand{\slant}{\textsl}
\newcommand{\bemph}[1]{\tbold{\emph{#1}}}
\newcommand{\mrm}{\mathrm}
\fi
%Option "misc"
\ifmw@misc
%A few unclassifiable shortcuts.
\RequirePackage{color,graphicx,xparse}
\newcommand{\tick}{\checkmark}
\newcommand{\crux}{\dagger}
\newcommand{\dcrux}{\ddagger}
\newcommand{\hs}{\heartsuit}
\newcommand{\ds}{\diamondsuit}
\newcommand{\cs}{\clubsuit}
\renewcommand{\ss}{\spadesuit}
\newcommand{\tcrux}{$\dagger$}
\newcommand{\tdcrux}{$\ddagger$}
\newcommand{\ths}{$\heartsuit$}
\newcommand{\tds}{$\diamondsuit$}
\newcommand{\tcs}{$\clubsuit$}
\newcommand{\tss}{$\spadesuit$}
\newcommand{\bs}{\backslash}
\newcommand{\tbs}{$\bs$}
\newcommand{\bk}{\Gr{ }}
\NewDocumentCommand{O{1}O{1}}
{\scalebox{#1}[#2]{\color{white}a}}
\fi
\endinput
generates error Extra \fi
on line 83 (right after \newcommand{\mrm}{\mathrm}
. If I add:
\ifxetex
\enginerighttrue
\else
\ifluatex
\enginerighttrue
\else
{}
\fi
\fi
before \ifengineright
, the error turns to Undefined control sequence. l.56 \ifengineright
.
What is happening here?
\else{}
? You shouldn't have\newif
inside a conditional.\if
with an\else
looks better than one without, to me at least. Could that cause problems?