I'm defining this command for my index: \newcommand*{command}{\iffirstsubsubitem\unskip\firstsubsubitemfalse\ \else; \fi} and I'm wondering if there is a way to eliminate the white space it prints just before the semicolon.
I tried with \newcommand*{command}{\iffirstsubsubitem\unskip\firstsubsubitemfalse\ \else\kern{-1ex}; \fi}, but the result isn't good.
Here is the MWE:
\documentclass[a4paper, 11pt, twoside, openright]{article}
\usepackage[top=49.5mm,bottom=52.5mm,inner=39mm,outer=39mm, headheight=4mm, headsep=6mm, marginparwidth=14mm, marginparsep=2mm, nofoot]{geometry}
\usepackage[no-math]{fontspec}
\defaultfontfeatures{Ligatures={TeX, NoCommon}}
\usepackage{polyglossia}
\setmainlanguage{italian}
\setotherlanguage[variant=ancient]{greek}
\setotherlanguage{german}
\setotherlanguage{english}
\setotherlanguage{latin}
\usepackage{microtype}
\usepackage{imakeidx}
\usepackage{xparse}
\makeindex[name=1,title=,options=-s Intero.ist]
\makeindex[name=2,title=,options=-s Intero.ist]
\makeindex[name=3,title=,options=-s Intero.ist]
\makeindex[name=4,title=,options=-s Intero.ist]
\usepackage[itemlayout=singlepar,font=footnotesize]{idxlayout}
\usepackage{xpatch}
\makeatletter
\def\@idxitem{\par\addvspace{10\p@ \@plus 5\p@ \@minus 3\p@}\hangindent 40\p@}
\def\subitem{\par\hangindent 40\p@ \hspace*{20\p@}}
\def\subsubitem{\par\hangindent 40\p@ \hspace*{30\p@}}
\def\indexspace{}
\patchcmd\theindex{\indexname}{\indexname\vspace{12pt}}{}{}
\makeatother
\makeatletter
\newif\iffirstsubitem
\newif\iffirstsubsubitem
\renewcommand{\indexsubsdelim}{ }
\newcommand*{\indexsubsdelimb}{\iffirstsubsubitem\unskip\firstsubsubitemfalse\ \else; \fi}
\renewcommand{\subitem}{\iffirstsubitem\unskip\firstsubitemfalse, \else; \fi\firstsubsubitemtrue}%
\renewcommand{\subsubitem}{\indexsubsdelimb}%
\renewcommand{\@idxitem}{\par\setlength{\hangindent}{\ila@hangindent}\firstsubitemtrue}
\makeatother
\newcommand*{\cose}[1]{\index[1]{#1}\ignorespaces}
\newcommand*{\parole}[1]{\index[2]{#1}\ignorespaces}
\newcommand*{\autori}[1]{\index[4]{#1}\ignorespaces}
\begin{document}
text
\autori{Author!Work1!1,15}
\autori{Author!Work1!9,31}
\autori{Author!Work2!2,24}
\autori{Author!Work2!5,11}
\autori{Author!Work2!2,25}
\autori{Author2!4,34}
\autori{Author3!6,12}
\autori{Author3!9,4}
\
\printindex[4]
\end{document}
\usepackage[french]{babel}, which might explain some things, but I can't find my good crystal ball, so... – frougon Apr 22 '20 at 23:34imakeidxwhich I have never used. What I can say with certainty is that a space before the;here isn't caused by the\iffirstsubitem ... \else ... \ficonstruct. Your code appears to define several macros twice (e.g.,\subitem,\subsubitem). Why? – frougon Apr 22 '20 at 23:46\defs (at least 3) are completely useless due to the subsequent\renewcommands. – frougon Apr 22 '20 at 23:57\unskipbefore the\iffirstsubitem. That\if...may insert bits that render the\unskipinoperative, and in any case, in its present position it doesn't apply to the\elsecondition, which is where the semicolon is inserted.. – barbara beeton Apr 23 '20 at 14:10