# How to custom (split in two)? Ibidem

Ok guys, here comes a really tough one, so I don't need an expert, but a superhero. I need to customize my idem/ibidem to match these possibilities:

• Same bibentry, same page -> Ibid. [without printing the page number]
• Same bibentry, different page -> Ivi, pagenumber
• Same author, different work -> ID. and what follows

I almost got there, but the footnote 2 of my MWE should be: 2. Ibid.

Perhaps I should introduce a new command which basically is: if there is an ibidem with the same page cited, print Ibid. and kill the pagenumber. The problem is that I have no idea about how to explain it to mr. LaTeX.

I'd appreciate very much any help on this hell issue

MWE:

% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode

\begin{filecontents}{archivio.bib}

@article{Ben:Mat,
Author = {Lise {Bender Jørgensen}},
Journal = {Antiquité Tardive},
Pages = {87-99},
Title = {A Matter of Material: Changes in Textiles from Roman Sites in Egypt's Eastern Desert},
Volume = {11},
Year = {2004}}

@book{Jor:For,
Author = {Lise {Bender Jørgensen}},
Publisher = {Nordiske Fortidsminder},
Title = {Forhistoriske textiler i Skandinavien},
Year = {1986}}

\end{filecontents}

\documentclass[11pt, openany]{book}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}
\setotherlanguages{latin, english, french}

%%% bibliografia
\usepackage[babel,italian=guillemets]{csquotes}
\usepackage{xpatch}
language=italian,
useprefix=true,
firstinits=true,
citepages=omit,
backend=biber,
]{biblatex}

\DefineBibliographyStrings{italian}{%                           Customizza Idem
idem   = {\textsc{id}},
ibidem = {Ivi},
}

%Idem appears on the second occurrence of the author name
\xpatchbibmacro{author}{\printnames{author}}{\iffootnote{\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}}{\usebibmacro{cite:idem}}{\printnames{author}}}{\printnames{author}}}{}{}
\xpatchbibmacro{editor}{\printnames{editor}}{\iffootnote{\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}}{\usebibmacro{cite:idem}}{\printnames{editor}}}{\printnames{editor}}}{}{}
\xpatchbibmacro{translator}{\printnames{translator}}{\iffootnote{\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}}{\usebibmacro{cite:idem}}{\printnames{translator}}}{\printnames{translator}}}{}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

First citation\footcite[88]{Ben:Mat}\\
I'citing the same page I need an \textit{ibidem}\footcite[88]{Ben:Mat} and no page number printed \\
Now I'm citing a different page, so I need \textit{Ivi}\footcite[87]{Ben:Mat}. \\
Here I'm citing just the same author, and I'd need \textsc{id.}\footcite{Jor:For}

\printbibliography

\end{document}

• What does "Ivi" stand for? – thymaro Mar 6 '18 at 19:39
• It's old italian and it means "here" – Teodoro Mar 9 '18 at 10:30

The ibidpage option can almost do that. We just need to define the two new strings and use those. You also need to patch slightly different macros for the idem.

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Ben:Mat,
Author = {Bender Jørgensen, Lise},
Journal = {Antiquité Tardive},
Pages = {87-99},
Title = {A Matter of Material: Changes in Textiles from Roman Sites in Egypt's Eastern Desert},
Volume = {11},
Year = {2004},
}

@book{Jor:For,
Author = {Bender Jørgensen, Lise},
Publisher = {Nordiske Fortidsminder},
Title = {Forhistoriske textiler i Skandinavien},
Year = {1986},
}
\end{filecontents}

\documentclass[11pt, openany]{book}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}
\setotherlanguages{latin, english, french}

\usepackage[autostyle,italian=guillemets]{csquotes}
\usepackage{xpatch}
language=italian,
useprefix=true,
giveninits=true,
citepages=omit,
backend=biber,
ibidpage=true,
]{biblatex}

\NewBibliographyString{ibidemloccit,ibidemnoloccit}
\DefineBibliographyStrings{italian}{%
idem           = {\textsc{id}},
ibidemnoloccit = {Ivi},
}

\xpatchbibmacro{author}
{\printnames{author}}
{\iffootnote
{\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}}
{\usebibmacro{cite:idem}}
{\printnames{author}}}
{\printnames{author}}}
{}{}
\xpatchbibmacro{bbx:editor}
{\printnames{editor}}
{\iffootnote
{\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}}
{\usebibmacro{cite:idem}}
{\printnames{editor}}}
{\printnames{editor}}}
{}{}
\xpatchbibmacro{bbx:translator}
{\printnames{translator}}
{\iffootnote
{\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}}
{\usebibmacro{cite:idem}}
{\printnames{translator}}}
{\printnames{translator}}}
{}{}

\renewbibmacro*{cite:ibid}{%
\printtext{%
\ifloccit
{\bibstring[\mkibid]{ibidemloccit}%
\global\toggletrue{cbx:loccit}}
{\bibstring[\mkibid]{ibidemnoloccit}}}}}