I need to know if a .bib file has fields such as PUBLISHER, DOI, URL, JOURNAL or are empty, this in order to create another new command where I can put conditionals and be able to automatically generate image citations according to APA. So far I have been able to know if the DOI, Journal and URL fields exist or are empty, but I HAVE NOT BEEN ABLE TO DETERMINE IF THE PUBLISHER FIELD EXISTS WITHOUT THE UNDEFINED ERROR APPEARING (if it is empty ) AT the time of running it in OVERLEAF.
NOTE, I have tried the same thing to do with the create command to know if it is a file using the \ifentrytype conditional to know if it is an article or book, but without any result.
\documentclass{article}
\usepackage{etoolbox} % para \ifstrequal
\usepackage{xstring}
\usepackage[T1]{fontenc}
\usepackage[spanish,es-tabla]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{csquotes}
\usepackage[backend=biber,style=apa,
maxbibnames=3,minbibnames=1]{biblatex}
\usepackage{ifthen}
\usepackage{pdftexcmds}
% MI JOURNAL
\DeclareCiteCommand{\citejournal}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{journal}}
{\multicitedelim}
{\usebibmacro{postnote}}
% MI URL
\DeclareCiteCommand{\miurl}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{url}}
{\multicitedelim}
{\usebibmacro{postnote}}
%PUBLISHER
\newcommand{\mipublisher}[1]{%
\entrydata{#1}{%
\iffieldundef{publisher}{%
% Si el campo 'publisher' no está definido
No hay publisher
}{%
% Si el campo 'publisher' está definido
Hay publisher: \citelist{#1}{publisher} % Imprime el valor de publisher
}%
}%
}
% DOI
\DeclareCiteCommand{\midoi}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex {\indexfield{indexdoi}}{}
\iffieldundef{doi}{nd}{\printfield{doi}}}{\multicitedelim}
{\usebibmacro{postnote}}
%DETERMINE IF IT IS AN ARTICLE OR A BOOK
% Comando para verificar si una entrada es un artículo
\DeclareCiteCommand{\citetypetest}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{entrytype}} % Modifica aquí para usar 'entrytype'
{\multicitedelim}
{\usebibmacro{postnote}}
%
\DefineBibliographyStrings{spanish}{
andothers = {et\addabbrvspace al\adddot},
andmore = {et\addabbrvspace al\adddot}}
\addbibresource{bibliografia.bib}
%
\begin{document}
- Doi-\midoi{Gonzales2010} \par
- Publisher- \mipublisher{Gonzales2010} \par %
- URL-\miurl{Gonzales2010} \par
- Journal-\citejournal{Gonzales2010} \par %
- mira esto: my \citelist{Garcia2022}{publisher} \par
- \ifentrytype{article}{Es un artículo}{No es un artículo}
- \mipublisher{Gonzales2010}
\end{document}
\iflistundef. – Ulrike Fischer Mar 01 '24 at 13:57