# \cite with large number of citekeys

I have a .sty file for my latex document where I create bibliography category (see[1] below). I have these lines in my document and it worked:

\addtocategory{papers}{sushil}


But in this way I have to add citekey by hand for a large number of articles. So I have been suggested to use this:

\AtEveryCitekey{%
\ifentrytype{article}{%
\iffieldundef{journaltitle}{%
}{%
}{%
}%
}
}


Which I guess is same thing but does things automatically. But this case does not work if I do not use \cite{sushil} which again brings me to the same point that I have to add citekeys by hand for a large number of articles. I thought that \nocite{*} could work but I already have \nocite{*} in my .sty file.

Does anyone knows how to solve this? I do not want to add so many citekeys by hand as its quite time taking.

[1]

From my .sty file:

% Bibliography categories
\makebibcategory{papers}{Refereed Research Papers}
\makebibcategory{subpapers}{Submitted Papers to Journals and arXiv}

\setlength{\bibitemsep}{2.65pt}
\setlength{\bibhang}{.8cm}
\renewcommand{\bibfont}{\small}

\defbibenvironment{bibliography}
{\list{}
{\setlength{\leftmargin}{\bibhang}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}}
{\endlist}
{\bibitem}

\titlespacing{\section}{0pt}{1.5ex}{1ex}\itemsep=0.00cm


-
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – Seamus Jun 22 '12 at 10:18

Make sure you are using biber as the backend and then you can add this automatically as biber reads your .bib file by putting this in your biber.cfg:

<sourcemap>
<maps datatype="bibtex">
<map final="true">
<per_type>ARTICLE</per_type>
<map_step map_field_source="JOURNAL/>
<map_step map_field_set="KEYWORDS" map_field_value="subpapers"/>
</map>
<map>
<per_type>ARTICLE</per_type>
<map_step map_field_set="KEYWORDS" map_field_value="subpapers"/>
</map>
</maps>
</sourcemap>


Or, if you are using the biblatex 2.0 and biber 1.0 betas, you can also do this on a per-document basis in your preamble:

\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\pertype{article}
\step[fieldsource=journal, final=true]
\step[fieldset=keywords, fieldvalue={papers}]
}
\map{
\pertype{article}
\step[fieldset=keywords, fieldvalue={subpapers}]
}
}
}


You can then simply filter on keywords with \printbibliography[keyword=papers] etc.

-
what package I need to add to my .tex file to use \DeclareSourcemap ?? – sushil Jun 25 '12 at 13:47
It's part of biblatex 2.0 which is on SourceForge but is not released yet to TexLive. I hope it will be released in a week or so. It's easy to install manually though. You must be using biber 1.0 too - this feature relies on biber. – PLK Jun 25 '12 at 15:48
Ok thank you very much for the help and infor. I will wait till it released. But do you know is there a way to add many keys to the following command: \addtocategory{papers}{key1,key2}. For 2 keys its fine but when dealing with 1000 keys its difficult to add them. – sushil Jun 26 '12 at 8:08
The sourcemap functionality is already in 1.7/0.9.9, but only via biber's config file. See the biber manual - you can do the same thing using the biber.conf file using biber's XML options format. It's only the LaTeX macro interface to this which has been added in 2.0. I wouldn't try to create a category like this - just add keywords using sourcemap and then filter on keywords instead of a category. – PLK Jun 26 '12 at 8:44
Could you please point me to the installation link. Thanks a lot once again. Sushil – sushil Jun 26 '12 at 15:48

If you are willing to add some extra information to the bib file you could add an entrysubtype field with papers\subpapers. Then \nocite{*} coupled with \printbibliography[subtype=papers] or possibly easier \printbibliography[notsubtype=subpapers]

-

No I have this example where I want to add citekeys in an automated way to \cite{} command instead of writing them by hand. Because I am dealing with >500 entries in my bib file and its difficult to add them by hand.

\documentclass{article}

\usepackage[defernumbers=true]{biblatex}

\DeclareBibliographyCategory{articlepublished}
\DeclareBibliographyCategory{articleunpublished}

\AtEveryCitekey{%
\ifentrytype{article}{%
\iffieldundef{journaltitle}{%
}{%
}%
}{%
}%
}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{AX12,
author         = "Authors1",
title          = "{Ttile of articles}",
collaboration  = "Collaboration",
year           = "2012",
}
@article{AY11,
author         = "Authors2",
title          = "{Ttile of articles}",
collaboration  = "Collaboration",
year           = "2011",
journal        = "Phys.Lett.",
}
\end{filecontents}