This question already has an answer here:
This is the first time I try to use Bibtex for my thesis and I am quite desperate because I cannot get it running. Despite the many post about the undefined references error in this forum, I still am not able to solve this matter.
I have created a very simple .bib and .tex file:
The .tex file:
Both files are located in the same folder and I run my mainfile multiple time. I use TexMaker combined with MikTeX2.9.
There is no error but the simple warning sequence:
LaTeX Warning: Citation `testcite' on page 1 undefined on input line 10 LaTeX Warning: There were undefined references.
I assume the error occurs somewhere in my TexMaker settings. Could you please help me?
asked May 1 '15 at 16:36
with contributions from Frank G. Bennett, Jr. and Bruce D’Arcus.
The Citation Style Language (CSL) is an XML-based format to describe the formatting of citations, notes and bibliographies, offering:
- An open format
- Compact and robust styles
- Extensive support for style requirements
- Automatic style localization
- Infrastructure for style distribution and updating
- Thousands of freely available styles (Creative Commons BY-SA licensed)
For additional documentation, the CSL schema, styles, and locales, visit the CSL project home, citationstyles.org.
The key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL, are to be interpreted as described in IETF RFC 2119.
The CSL XML namespace URI is “http://purl.org/net/xbiblio/csl”. The namespace prefix is used throughout this specification when referring to CSL elements, but is generally omitted in favor of a default namespace declaration (set with the attribute) on the root or element.
There are three types of CSL files: independent and dependent styles (both types use the “.csl” extension), and locale files (named “locales-xx-XX.xml”, where “xx-XX” is a language dialect, e.g. “en-US” for American English).
Independent styles contain formatting instructions for citations, notes and bibliographies. While mostly self-contained, they rely on locale files for (default) localization data.
A dependent style is an alias for an independent style. Its contents are limited to style metadata, and doesn’t include any formatting instructions (the sole exception is that dependent styles can specify an overriding style locale). By linking dependent styles for journals that share the same citation style (e.g., “Nature Biotechnology”, “Nature Nanotechnology”, etc.) to a single independent style (e.g., “Nature Journals”), there is no need to duplicate formatting instructions.
Each locale file contains a set of localization data (term translations, localized date formats, and grammar options) for a particular language dialect.
Each style or locale should begin with an XML declaration, specifying the XML version and character encoding. In most cases, the declaration will be:
Styles - Structure¶
The Root Element - ¶
The root element of styles is . In independent styles, the element carries the following attributes:
- Determines whether the style uses in-text citations (value “in-text”) or notes (“note”).
- Sets a default locale for style localization. Value must be a locale code.
- The CSL version of the style. Must be “1.0” for CSL 1.0-compatible styles.
In addition, may carry any of the global options and inheritable name options.
Of these attributes, only is required on in dependent styles, while the attribute may be set to specify an overriding style locale. The other attributes are allowed but ignored.
An example of for an independent style, preceded by the XML declaration:
Child Elements of ¶
In independent styles, the root element has the following child elements:
- Must appear as the first child element of . Contains the metadata describing the style (style name, ID, authors, etc.).
- Must appear once. Describes the formatting of in-text citations or notes.
- May appear once. Describes the formatting of the bibliography.
- May appear multiple times. Macros allow formatting instructions to be reused, keeping styles compact and maintainable.
- May appear multiple times. Used to specify (overriding) localization data.
In dependent styles, has only one child element, .
The element contains the style’s metadata. Its structure is based on the Atom Syndication Format. In independent styles, has the following child elements:
- and (optional)
- and , used to respectively acknowledge style authors and contributors, may each be used multiple times. Within these elements, the child element must appear once, while and each may appear once. These child elements should contain respectively the name, email address and URI of the author or contributor.
Styles may be assigned one or more categories. may be used once to describe how in-text citations are rendered, using the attribute set to one of the following values:
- “author-date” - e.g. “… (Doe, 1999)”
- “author” - e.g. “… (Doe)”
- “numeric” - e.g. “… ”
- “label” - e.g. “… [doe99]”
- “note” - the citation appears as a footnote or endnote
may be used multiple times with the attribute, set to one of the discipline categories (see Appendix I - Categories), to indicates the field(s) for which the style is relevant.
- Must appear once. The element should contain a URI to establish the identity of the style. A stable, unique and dereferenceable URI is desired for publicly available styles.
- // (optional)
- The element may be used multiple times to indicate the ISSN identifier(s) of the journal for which the style was written. The and elements may each be used once for the eISSN and ISSN-L identifiers, respectively.
May be used multiple times. must carry two attributes: , set to a URI (usually a URL), and , whose value indicates how the URI relates to the style. The possible values of :
- “self” - style URI
- “template” - URI of the style from which the current style is derived
- “documentation - URI of style documentation
The element may contain content describing the link.
- May appear once. The contents of must be a timestamp, indicating when the style was initially created or made available.
- May appear once. The contents of specifies the license under which the style file is released. The element may carry a attribute to specify the URI of the license.
- May appear once. The contents of gives a (short) description of the style.
- Must appear once. The contents of should be the name of the style as shown to users.
- May appear once. The contents of should be a shortened style name (e.g. “APA”).
- Must appear once. The contents of must be a timestamp that shows when the style was last updated.
The , , , and elements may carry a attribute to specify the language of the element’s content (the value must be an xsd:language locale code). For , the attribute can also be used to indicate the language of the link target.
In dependent styles, must be used with set to “independent-parent”, with the URI of the independent parent style set on . In addition, should not be used with set to “template”.
An example of for an independent style:
The element describes the formatting of citations, which consist of one or more references (“cites”) to bibliographic sources. Citations appear in the form of either in-text citations (in the author (e.g. “[Doe]”), author-date (“[Doe 1999]”), label (“[doe99]”) or number (“”) format) or notes. The required child element describes what, and how, bibliographic data should be included in the citations (see Layout). may be preceded by a element, which can be used to specify how cites within a citation should be sorted (see Sorting). The element may carry attributes for Citation-specific Options and Inheritable Name Options. An example of a element:
A note to CSL processor developers In note styles, a citation is often a sentence by itself. Therefore, the first character of a citation should preferably be uppercased when there is no preceding text in the note. In all other cases (e.g. when a citation is inserted into the middle of a pre-existing footnote), the citation should be printed as is.
The element describes the formatting of bibliographies, which list one or more bibliographic sources. The required child element describes how each bibliographic entry should be formatted. may be preceded by a element, which can be used to specify how references within the bibliography should be sorted (see Sorting). The element may carry attributes for Bibliography-specific Options and Inheritable Name Options. An example of a element:
Macros, defined with elements, contain formatting instructions. Macros can be called with from within other macros and the element of and , and with from within of and . It is recommended to place macros after any elements and before the element.
Macros are referenced by the value of the required attribute on . The element must contain one or more rendering elements.
The use of macros can improve style readability, compactness and maintainability. It is recommended to keep the contents of and compact and agnostic of item types (e.g. books, journal articles, etc.) by depending on macro calls. To allow for easy reuse of macros in other styles, it is recommended to use common macro names.
In the example below, cites consist of the item title, rendered in italics when the item type is “book”:
Localization data, by default drawn from the “locales-xx-XX.xml” locale files, may be redefined or supplemented with elements, which should be placed directly after the element.
The value of the optional attribute on , which must be set to an xsd:language locale code, determines which languages or language dialects are affected (see Locale Fallback).
See Terms, Localized Date Formats and Localized Options for further details on the use of .
An example of in a style:
Locale files provide localization data for language dialects (e.g. “en-US” for American English), whereas the optional elements in styles can either lack the attribute, or have it set to either a language (e.g. “en” for English) or dialect. Locale fallback is the mechanism determining from which of these sources each localizable unit (a date format, localized option, or specific form of a term) is retrieved.
For dialects of the same language, one is designated the primary dialect. All others are secondaries. At the moment of writing, the available locale files include:
|Primary dialect||Secondary dialect(s)|
Locale fallback is best described with an example. If the chosen output locale is “de-AT” (Austrian German), localizable units are individually drawn from the following sources, in decreasing order of priority:
- In-style elements
- set to chosen dialect, “de-AT”
- set to matching language, “de” (German)
- not set
- Locale files
- set to chosen dialect, “de-AT”
- set to matching primary dialect, “de-DE” (Standard German) (only applicable when the chosen locale is a secondary dialect)
- set to “en-US” (American English)
If the chosen output locale is a language (e.g. “de”), the (primary) dialect is used in step 1 (e.g. “de-DE”).
Fallback stops once a localizable unit has been found. For terms, this even is the case when they are defined as empty strings (e.g. or ). Locale fallback takes precedence over fallback of term forms (see Terms).
Locale Files - Structure¶
While localization data can be included in styles (see Locale), locale files conveniently provide sets of default localization data, consisting of terms, date formats and grammar options.
Each locale file contains localization data for a single language dialect. This locale code is set on the required attribute on the root element. The same locale code must also be used in the file name of the locale file (the “xx-XX” in “locales-xx-XX.xml”). The root element must carry the attribute, indicating the CSL version of the locale file (must be “1.0” for CSL 1.0-compatible locale files). Locale files have the same requirements for namespacing as styles. The element may contain as its first child element, and requires the child elements , and (these elements are described below). An example showing part of a locale file:
The element may be used to give metadata on the locale file. It has the following child elements:
- , used to acknowledge locale translators, may be used multiple times. Within the element, the child element must appear once, while and each may appear once. These child elements should contain respectively the name, email address and URI of the translator.
- May appear once. The contents of specifies the license under which the locale file is released. The element may carry a attribute to specify the URI of the license, and a attribute to specify the language of the element’s content (the value must be an xsd:language locale code).
- May appear once. The contents of must be a timestamp that shows when the locale file was last updated.
Terms are localized strings (e.g. by using the “and” term, “Doe and Smith” automatically becomes “Doe und Smith” when the style locale is switched from English to German). Terms are defined with elements, child elements of . Each element must carry a attribute, set to one of the terms listed in Appendix II - Terms.
Terms are either directly defined in the content of , or, in cases where singular and plural variants are needed (e.g. “page” and “pages”), in the content of the child elements and , respectively.
Terms may be defined for specific forms by using with the optional attribute set to:
- “long” - (default), e.g. “editor” and “editors” for the “editor” term
- “short” - e.g. “ed.” and “eds.” for the term “editor”
- “verb” - e.g. “edited by” for the term “editor”
- “verb-short” - e.g. “ed.” for the term “editor”
- “symbol” - e.g. “§” and “§§” for the term “section”
If a style uses a term in a form that is undefined (even after Locale Fallback), there is fallback to other forms: “verb-short” first falls back to “verb”, “symbol” first falls back to “short”, and “verb” and “short” both fall back to “long”. If no locale or form fallback is available, the term is rendered as an empty string.
The , , and attributes can be used on for the formatting of number variables rendered as ordinals (e.g. “first”, “2nd”). See Ordinal Suffixes and Gender-specific Ordinals below.
Term content should not contain markup such as LaTeX or HTML. Superscripted Unicode characters can be used for superscripting.
Number variables can be rendered with in the “ordinal” form, e.g. “2nd” (see Number). The ordinal suffixes (“nd” for “2nd”) are defined with terms.
The “ordinal” term defines the default ordinal suffix. This default suffix may be overridden for certain numbers with the following terms:
- “ordinal-00” through “ordinal-09” - by default, a term in this group is used when the last digit in the term name matches the last digit of the rendered number. E.g. “ordinal-00” would match the numbers “0”, “10”, “20”, etc. By setting the optional attribute to “last-two-digits” (“last-digit” is the default), matches are limited to numbers where the two last digits agree (“0”, “100”, “200”, etc.). When is set to “whole-number”, there is only a match if the number is the same as that of the term.
- “ordinal-10” through “ordinal-99” - by default, a term in this group is used when the last two digits in the term name match the last two digits of the rendered number. When the optional attribute is set to “whole-number” (“last-two-digits” is the default), there is only a match if the number is the same as that of the term.
When a number has matching terms from both groups (e.g. “13” can match “ordinal-03” and “ordinal-13”), the term from the “ordinal-10” through “ordinal-99” group is used.
Ordinal terms work differently in CSL 1.0.1 than they did in CSL 1.0. When neither the style or locale file define the “ordinal” term, but do define the terms “ordinal-01” through “ordinal-04”, the original CSL 1.0 scheme is used: “ordinal-01” is used for numbers ending on a 1 (except those ending on 11), “ordinal-02” for those ending on a 2 (except those ending on 12), “ordinal-03” for those ending on a 3 (except those ending on 13) and “ordinal-04” for all other numbers.
Some languages use gender-specific ordinals. For example, the English “1st” and “first” translate in French to “1er” and “premier” if the target noun is masculine, and “1re” and “première” if the noun is feminine.
Feminine and masculine variants of the ordinal terms (see Ordinals) may be specified by setting the attribute to “feminine” or “masculine” (the term without represents the neuter variant). There are two types of target nouns: a) the terms accompanying the number variables, and b) the month terms (see Months). The gender of these nouns may be specified on the “long” (default) form of the term using the attribute (set to “feminine” or “masculine”). When a number variable is rendered with in the “ordinal” or “long-ordinal” form, the ordinal term of the same gender is used, with a fallback to the neuter variant if the feminine or masculine variant is undefined. When the “day” date-part is rendered in the “ordinal” form, the ordinal gender is matched against that of the month term.
The example below gives “1re éd.” (“1st ed.”), “1er janvier” (“January 1st”), and “3e édition” (“3rd edition”):
Localized Date Formats¶
Two localized date formats can be defined with elements: a “numeric” (e.g. “12-15-2005”) and a “text” format (e.g. “December 15, 2005”). The format is set on with the required attribute.
A date format is constructed using child elements (see Date-part). With a required attribute set to either , or , the order of these elements reflects the display order of respectively the day, month, and year. The date can be formatted with formatting and text-case attributes on the and elements. The delimiter attribute may be set on to specify the delimiter for the elements, and affixes may be applied to the elements.
Note Affixes are not allowed on when defining localized date formats. This restriction is in place to separate locale-specific affixes (set on the elements) from any style-specific affixes (set on the calling element), such as parentheses. An example of a macro calling a localized date format:
There are two localized options, and (see Locale Options). These global options (which affect both citations and the bibliography) are set as optional attributes on .
Rendering elements specify which, and in what order, pieces of bibliographic metadata are included in citations and bibliographies, and offer control over their formatting.
The rendering element is a required child element of and . It must contain one or more of the other rendering elements described below, and may carry affixes and formatting attributes. When used within , the delimiter attribute may be used to specify a delimiter for cites within a citation. For example, a citation like “(1, 2)” can be achieved with:
The rendering element outputs text. It must carry one of the following attributes to select what should be rendered:
- - renders the text contents of a variable. Attribute value must be one of the standard variables. May be accompanied by the attribute to select the “long” (default) or “short” form of a variable (e.g. the full or short title). If the “short” form is selected but unavailable, the “long” form is rendered instead.
- - renders the text output of a macro. Attribute value must match the value of the attribute of a element (see Macro).
- - renders a term. Attribute value must be one of the terms listed in Appendix II - Terms. May be accompanied by the attribute to select the singular (“false”, default) or plural (“true”) variant of a term, and by the attribute to select the “long” (default), “short”, “verb”, “verb-short” or “symbol” form variant (see also Terms).
- - renders the attribute value itself.
An example of rendering the “title” variable:
may also carry affixes, display, formatting, quotes, strip-periods and text-case attributes.
The rendering element outputs the date selected from the list of date variables with the required attribute. A date can be rendered in either a localized or non-localized format.
Localized date formats are selected with the optional attribute, which must set to either “numeric” (for fully numeric formats, e.g. “12-15-2005”), or “text” (for formats with a non-numeric month, e.g. “December 15, 2005”). Localized date formats can be customized in two ways. First, the attribute may be used to show fewer date parts. The possible values are:
- “year-month-day” - (default), renders the year, month and day
- “year-month” - renders the year and month
- “year” - renders the year
Secondly, may have one or more child elements (see Date-part). The attributes set on these elements override those specified for the localized date formats (e.g. to get abbreviated months for all locales, the attribute on the month- element can be set to “short”). These elements do not affect which, or in what order, date parts are rendered. Affixes, which are very locale-specific, are not allowed on these elements.
In the absence of the attribute, describes a self-contained non-localized date format. In this case, the date format is constructed using child elements. With a required attribute set to either , or , the order of these elements reflects the display order of respectively the day, month, and year. The date can be formatted with formatting attributes on the elements, as well as several -specific attributes (see Date-part). The delimiter attribute may be set on to specify the delimiter for the elements, and affixes may be applied to the elements.
For both localized and non-localized dates, may carry affixes, display, formatting and text-case attributes.
The elements control how date parts are rendered. Unless the parent element calls a localized date format, they also determine which, and in what order, date parts appear. A element describes the date part selected with the required attribute:
For “day”, may carry the attribute, with values:
- “numeric” - (default), e.g. “1”
- “numeric-leading-zeros” - e.g. “01”
- “ordinal” - e.g. “1st”
Some languages, such as French, only use the “ordinal” form for the first day of the month (“1er janvier”, “2 janvier”, “3 janvier”, etc.). Such output can be achieved with the “ordinal” form and use of the attribute (see Locale Options).
For “month”, may carry the strip-periods and attributes. In locale files, month abbreviations (the “short” form of the month terms) should be defined with periods if applicable (e.g. “Jan.”, “Feb.”, etc.). These periods can be removed by setting strip-periods to “true” (“false” is the default). The attribute can be set to:
- “long” - (default), e.g. “January”
- “short” - e.g. “Jan.”
- “numeric” - e.g. “1”
- “numeric-leading-zeros” - e.g. “01”
For “year”, may carry the attribute, with values:
- “long” - (default), e.g. “2005”
- “short” - e.g. “05”
may also carry formatting, text-case and (see Date Ranges) attributes. Attributes for affixes are allowed, unless calls a localized date format.
The default delimiter for dates in a date range is an en-dash (e.g. “May–July 2008”). Custom range delimiters can be set on elements with the optional attribute. When a date range is rendered, the range delimiter is drawn from the element matching the largest date part (“year”, “month”, or “day”) that differs between the two dates. For example,
would result in “1-4 May 2008”, “May–July 2008” and “May 2008/June 2009”.
AD and BC¶
The “ad” term (Anno Domini) is automatically appended to positive years of less than four digits (e.g. “79” becomes “79AD”). The “bc” term (Before Christ) is automatically appended to negative years (e.g. “-2500” becomes “2500BC”).
If a date includes a season instead of a month, a season term (“season-01” to “season-04”, respectively Spring, Summer, Autumn and Winter) take the place of the month term. E.g.,
would result in “May 2008” and “Winter 2009”.
Approximate dates test “true” for the conditional (see Choose). For example,
would result in “2005” (normal date) and “ca. 2003” (approximate date).
The rendering element outputs the number variable selected with the required attribute. Number variables are a subset of the list of standard variables.
If a number variable is rendered with and only contains numeric content (as determined by the rules for , see Choose), the number(s) are extracted. Variable content is rendered “as is” when the variable contains any non-numeric content (e.g. “Special edition”).
During the extraction, numbers separated by a hyphen are stripped of intervening spaces (“2 - 4” becomes “2-4”). Numbers separated by a comma receive one space after the comma (“2,3” and “2 , 3” become “2, 3”), while numbers separated by an ampersand receive one space before and one after the ampersand (“2&3” becomes “2 & 3”).
Extracted numbers can be formatted via the optional attribute, with values:
- “numeric” - (default), e.g. “1”, “2”, “3”
- “ordinal” - e.g. “1st”, “2nd”, “3rd”. Ordinal suffixes are defined with terms (see Ordinal Suffixes).
- “long-ordinal” - e.g. “first”, “second”, “third”. Long ordinals are defined with the terms “long-ordinal-01” to “long-ordinal-10”, which are used for the numbers 1 through 10. For other numbers “long-ordinal” falls back to “ordinal”.
- “roman” - e.g. “i”, “ii”, “iii”
Numbers with prefixes or suffixes are never ordinalized or rendered in roman numerals (e.g. “2E” remains “2E). Numbers without affixes are individually transformed (“2, 3” can become “2nd, 3rd”, “second, third” or “ii, iii”).
may carry affixes, display, formatting and text-case attributes.
The rendering element outputs the contents of one or more name variables (selected with the required attribute), each of which can contain multiple names (e.g. the “author” variable contains all the author names of the cited item). If multiple variables are selected (separated by single spaces, see example below), each variable is independently rendered in the order specified, with one exception: when the selection consists of “editor” and “translator”, and when the contents of these two name variables is identical, then the contents of only one name variable is rendered. In addition, the “editortranslator” term is used if the element contains a element, replacing the default “editor” and “translator” terms (e.g. resulting in “Doe (editor & translator)”). The delimiter attribute may be set on to separate the names of the different name variables (e.g. the semicolon in “Doe, Smith (editors); Johnson (translator)”).
has four child elements (discussed below): , , and . The element may carry affixes, display and formatting attributes.
The element, an optional child element of , can be used to describe the formatting of individual names, and the separation of names within a name variable. may carry the following attributes:
- Specifies the delimiter between the second to last and last name of the names in a name variable. Allowed values are “text” (selects the “and” term, e.g. “Doe, Johnson and Smith”) and “symbol” (selects the ampersand, e.g. “Doe, Johnson & Smith”).
- Specifies the text string used to separate names in a name variable. Default is “, ” (e.g. “Doe, Smith”).
Determines when the name delimiter or a space is used between a truncated name list and the “et-al” (or “and others”) term in case of et-al abbreviation. Allowed values:
- “contextual” - (default), name delimiter is only used for name lists truncated to two or more names
- 1 name: “J. Doe et al.”
- 2 names: “J. Doe, S. Smith, et al.”
- “after-inverted-name” - name delimiter is only used if the preceding name is inverted as a result of the attribute. E.g. with set to “first”:
- “Doe, J., et al.”
- “Doe, J., S. Smith et al.”
- “always” - name delimiter is always used
- 1 name: “J. Doe, et al.”
- 2 names: “J. Doe, S. Smith, et al.”
- “never” - name delimiter is never used
- “contextual” - (default), name delimiter is only used for name lists truncated to two or more names