/usr/share/doc/pybtex/html/api/formatting.html is in pybtex 0.20.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Formatting bibliographies — Pybtex User’s Guide (0.20.1)</title>
<link rel="stylesheet" href="../_static/master.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../index.html',
VERSION: '0.20.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Pybtex User’s Guide" href="../index.html" />
<link rel="up" title="Python API" href="index.html" />
<link rel="next" title="Designing styles" href="styles.html" />
<link rel="prev" title="Reading and writing bibliography data" href="parsing.html" />
</head>
<body role="document">
<div class="relbar">
<div class="left">
<a href="http://pybtex.org/">Pybtex</a> /
<a href="../index.html">Docs</a> /
<a href="index.html" accesskey="U">Python API</a> /
Formatting bibliographies
</div>
<div class="right">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" placeholder="Enter search text..."/>
<input type="submit" value="Search" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="content">
<div class="body" role="main">
<div class="section" id="formatting-bibliographies">
<h1>Formatting bibliographies<a class="headerlink" href="#formatting-bibliographies" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bibtex-engine" id="id4">BibTeX engine</a><ul>
<li><a class="reference internal" href="#how-it-works" id="id5">How it works</a></li>
</ul>
</li>
<li><a class="reference internal" href="#python-engine" id="id6">Python engine</a><ul>
<li><a class="reference internal" href="#differences-from-the-bibtex-engine" id="id7">Differences from the BibTeX engine</a></li>
<li><a class="reference internal" href="#id3" id="id8">How it works</a></li>
</ul>
</li>
<li><a class="reference internal" href="#python-api" id="id9">Python API</a><ul>
<li><a class="reference internal" href="#the-base-interface" id="id10">The base interface</a></li>
<li><a class="reference internal" href="#the-bibtexengine-class" id="id11">The BibTeXEngine class</a></li>
<li><a class="reference internal" href="#the-pybtexengine-class" id="id12">The PybtexEngine class</a></li>
</ul>
</li>
</ul>
</div>
<p>The main purpose of Pybtex is turning machine-readable bibliography data into
human-readable bibliographies formatted in a specific style.
Pybtex reads bibliography data that looks like this:</p>
<div class="highlight-bibtex"><div class="highlight"><pre><span></span><span class="nc">@book</span><span class=" -Punctuation">{</span><span class="nl">graham1989concrete</span><span class=" -Punctuation">,</span>
<span class=" -Punctuation">title</span> <span class=" -Punctuation">=</span> <span class="s">"Concrete mathematics: a foundation for computer science"</span><span class=" -Punctuation">,</span>
<span class=" -Punctuation">author</span> <span class=" -Punctuation">=</span> <span class="s">"Graham, Ronald Lewis and Knuth, Donald Ervin and Patashnik, Oren"</span><span class=" -Punctuation">,</span>
<span class=" -Punctuation">year</span> <span class=" -Punctuation">=</span> <span class="s">"1989"</span><span class=" -Punctuation">,</span>
<span class=" -Punctuation">publisher</span> <span class=" -Punctuation">=</span> <span class="s">"Addison-Wesley"</span>
<span class=" -Punctuation">}</span>
</pre></div>
</div>
<p>and formats it like this:</p>
<blockquote>
<div>R. L. Graham, D. E. Knuth, and O. Patashnik.
<em>Concrete mathematics: a foundation for computer science</em>.
Addison-Wesley, 1989.</div></blockquote>
<p>Pybtex contains two different formatting engines:</p>
<ul class="simple">
<li>The <a class="reference internal" href="#bibtex-engine"><span>BibTeX engine</span></a> uses BibTeX <code class="docutils literal"><span class="pre">.bst</span></code> styles.</li>
<li>The <a class="reference internal" href="#python-engine"><span>Python engine</span></a> uses styles written in Python.</li>
</ul>
<div class="section" id="bibtex-engine">
<span id="id1"></span><h2><a class="toc-backref" href="#id4">BibTeX engine</a><a class="headerlink" href="#bibtex-engine" title="Permalink to this headline">¶</a></h2>
<p>The BibTeX engine is fully compatible with BibTeX style files and is used by default.</p>
<div class="section" id="how-it-works">
<h3><a class="toc-backref" href="#id5">How it works</a><a class="headerlink" href="#how-it-works" title="Permalink to this headline">¶</a></h3>
<p>When you type <strong class="command">pybtex mydocument</strong>, the following things happen:</p>
<ol class="arabic">
<li><p class="first">Pybtex reads the file <code class="file docutils literal"><span class="pre">mydocument.aux</span></code> in the current directory.
This file is normally created by LaTeX and contains all sorts of auxiliary information
collected during processing of the LaTeX document.</p>
<p>Pybtex is interested in these three pieces of information:</p>
<dl class="docutils">
<dt>Bibliography style:</dt>
<dd><p class="first">First, Pybtex searches the <code class="file docutils literal"><span class="pre">.aux</span></code> file for a <code class="docutils literal"><span class="pre">\bibstyle</span></code>
command that specifies which formatting style will be used.</p>
<p class="last">For example, <code class="docutils literal"><span class="pre">\bibstyle{unsrt}</span></code> instructs Pybtex to use formatting
style defined in the file <code class="file docutils literal"><span class="pre">unsrt.bst</span></code>.</p>
</dd>
<dt>Bibliography data:</dt>
<dd><p class="first">Next, Pybtex expects to find at least one <code class="docutils literal"><span class="pre">\bibdata</span></code> command in the
<code class="file docutils literal"><span class="pre">.aux</span></code> file that tells where to look for the bibliography data.</p>
<p class="last">For example, <code class="docutils literal"><span class="pre">\bibdata{mydocument}</span></code> means “use the bibliography data
from <code class="file docutils literal"><span class="pre">mydocument.bib</span></code>”.</p>
</dd>
<dt>Citations:</dt>
<dd><p class="first">Finally, Pybtex needs to know which entries to put into the resulting
bibliography. Pybtex gets the list of citation keys from
<code class="docutils literal"><span class="pre">\citation</span></code> commands in the <code class="file docutils literal"><span class="pre">.aux</span></code> file.</p>
<p>For example, <code class="docutils literal"><span class="pre">\citation{graham1989concrete}</span></code> means “include the
entry with the key <code class="docutils literal"><span class="pre">graham1989concrete</span></code> into the resulting bibliograhy”.</p>
<p class="last">A wildcard citation <code class="docutils literal"><span class="pre">\citation{*}</span></code> tells Pybtex to format the
bibliography for all entries from all data files specified by
all <code class="docutils literal"><span class="pre">\bibdata</span></code> commands.</p>
</dd>
</dl>
</li>
<li><p class="first">Pybtex executes the style program in the <code class="file docutils literal"><span class="pre">.bst</span></code> file specified by
the <code class="docutils literal"><span class="pre">\bibstyle</span></code> command in the <code class="file docutils literal"><span class="pre">.aux</span></code> file. As a result, a
<code class="file docutils literal"><span class="pre">.bbl</span></code> file containing the resulting formatted bibliography is
created.</p>
<p>A <code class="file docutils literal"><span class="pre">.bst</span></code> style file is a program in a domain-specific stack-based
language. A typical piece of the <code class="file docutils literal"><span class="pre">.bst</span></code> code looks like this:</p>
<div class="highlight-bst-pybtex"><div class="highlight"><pre><span></span><span class="nc">FUNCTION</span> <span class=" -Punctuation">{</span><span class="nv">format.bvolume</span><span class=" -Punctuation">}</span>
<span class=" -Punctuation">{</span> <span class="nv">volume</span> <span class="nb">empty$</span>
<span class=" -Punctuation">{</span> <span class="s">""</span> <span class=" -Punctuation">}</span>
<span class=" -Punctuation">{</span> <span class="s">"volume"</span> <span class="nv">volume</span> <span class="nv">tie.or.space.connect</span>
<span class="nv">series</span> <span class="nb">empty$</span>
<span class="nb">'skip$</span>
<span class=" -Punctuation">{</span> <span class="s">" of "</span> <span class="nv">*</span> <span class="nv">series</span> <span class="nv">emphasize</span> <span class="nv">*</span> <span class=" -Punctuation">}</span>
<span class="nb">if$</span>
<span class="s">"volume and number"</span> <span class="nv">number</span> <span class="nv">either.or.check</span>
<span class=" -Punctuation">}</span>
<span class="nb">if$</span>
<span class=" -Punctuation">}</span>
</pre></div>
</div>
<p>The code in a <code class="file docutils literal"><span class="pre">.bst</span></code> file contains the complete step-by-step
instructions on how to create the formatted bibliography from the given
bibliography data and citation keys. For example, a <code class="docutils literal"><span class="pre">READ</span></code> command
tells Pybtex to read the bibliography data from all files specified by
<code class="docutils literal"><span class="pre">\bibdata</span></code> commands in the <code class="docutils literal"><span class="pre">.aux</span></code> file, an <code class="docutils literal"><span class="pre">ITERATE</span></code> command tells
Pybtex to execute a piece of code for each citation key specified by
<code class="docutils literal"><span class="pre">\citation</span></code> commands, and so on. The built-in <code class="docutils literal"><span class="pre">write$</span></code> function tells
Pybtex to write the given string into the resulting <code class="file docutils literal"><span class="pre">.bbl</span></code> file.
Pybtex implements all these commands and built-in functions and simply
executes the <code class="file docutils literal"><span class="pre">.bst</span></code> program step by step.</p>
<p>A complete reference of the <code class="file docutils literal"><span class="pre">.bst</span></code> language can be found in the
<a class="reference external" href="http://mirrors.ctan.org/biblio/bibtex/base/btxhak.pdf">BibTeX hacking guide</a> by Oren Patashnik. It is available by running
<strong class="command">texdoc btxhak</strong> in most TeX distributions.</p>
</li>
</ol>
</div>
</div>
<div class="section" id="python-engine">
<span id="id2"></span><h2><a class="toc-backref" href="#id6">Python engine</a><a class="headerlink" href="#python-engine" title="Permalink to this headline">¶</a></h2>
<p>The Python engine is enabled by running <strong class="command">pybtex</strong> with the <code class="xref std std-option docutils literal"><span class="pre">-l</span> <span class="pre">python</span></code> option.</p>
<div class="section" id="differences-from-the-bibtex-engine">
<h3><a class="toc-backref" href="#id7">Differences from the BibTeX engine</a><a class="headerlink" href="#differences-from-the-bibtex-engine" title="Permalink to this headline">¶</a></h3>
<ul class="simple">
<li>Formatting styles are written in Python instead of the <code class="file docutils literal"><span class="pre">.bst</span></code> language.</li>
<li>Formatting styles are not tied to LaTeX and do not use hardcoded LaTeX
markup. Instead of that they produce format-agnostic <a class="reference internal" href="styles.html#pybtex.richtext.Text" title="pybtex.richtext.Text"><code class="xref py py-class docutils literal"><span class="pre">pybtex.richtext.Text</span></code></a>
objects that can be converted to any markup format (LaTeX, Markdown, HTML, etc.).</li>
<li>Name formatting, label formatting, and sorting styles are defined separately
from the main style.</li>
</ul>
</div>
<div class="section" id="id3">
<h3><a class="toc-backref" href="#id8">How it works</a><a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3>
<p>When you type <strong class="command">pybtex -l python mydocument</strong>, this things happen:</p>
<ol class="arabic">
<li><p class="first">Pybtex reads the file <code class="file docutils literal"><span class="pre">mydocument.aux</span></code> in the current directory and
extracts the name of the the bibliography style, the list of bibliography
data files and the list of citation keys.
This step is exactly the same as with the BibTeX engine.</p>
</li>
<li><p class="first">Pybtex reads the biliography data from all data files specified in the
<code class="file docutils literal"><span class="pre">.aux</span></code> file into a single <a class="reference internal" href="parsing.html#pybtex.database.BibliographyData" title="pybtex.database.BibliographyData"><code class="xref py py-class docutils literal"><span class="pre">BibliographyData</span></code></a> object.</p>
</li>
<li><p class="first">Then the formatting style is loaded. The formatting style is a
Python class with a <a class="reference internal" href="styles.html#pybtex.style.formatting.BaseStyle.format_bibliography" title="pybtex.style.formatting.BaseStyle.format_bibliography"><code class="xref py py-meth docutils literal"><span class="pre">format_bibliography()</span></code></a> method. Pybtex passes the
bibliography data (a <a class="reference internal" href="parsing.html#pybtex.database.BibliographyData" title="pybtex.database.BibliographyData"><code class="xref py py-class docutils literal"><span class="pre">BibliographyData</span></code></a> object) and the list of
citation keys to <a class="reference internal" href="styles.html#pybtex.style.formatting.BaseStyle.format_bibliography" title="pybtex.style.formatting.BaseStyle.format_bibliography"><code class="xref py py-meth docutils literal"><span class="pre">format_bibliography()</span></code></a>.</p>
</li>
<li><p class="first">The formatting style formats each of the requested bibliography entries
in a style-specific way.</p>
<p>When it comes to formatting names, a name formatting style is loaded and
used. A name formatting style is also a Python class with a specific
interface. Similarly, a label formatting style is used to format entry
labels, and a sorting style is used to sort the resulting style. Each
formatting style has a default name style, a default label style and a
default sorting style. The defaults can be overridden with options passed
to the main style class.</p>
<p>Each formatted entry is put into a <code class="xref py py-class docutils literal"><span class="pre">FormattedEntry</span></code> object
which is just a container for the formatted label, the formatted entry
text (a <a class="reference internal" href="styles.html#pybtex.richtext.Text" title="pybtex.richtext.Text"><code class="xref py py-class docutils literal"><span class="pre">pybtex.richtext.Text</span></code></a> object) and the entry key. The reason
that the label, the key and the main text are stored separately is to give the
output backend more flexibility when converting the
<code class="xref py py-class docutils literal"><span class="pre">FormattedEntry</span></code> object to the actual markup. For example, the
HTML backend may want to format the bibliography as a definition list, the
LaTeX backend would use <code class="docutils literal"><span class="pre">\bibitem[label]{key}</span> <span class="pre">text</span></code> constructs, etc.</p>
<p>Formatted entries are put into a <code class="xref py py-class docutils literal"><span class="pre">FormattedBibliography</span></code>
object—it simply contains a list of <code class="xref py py-class docutils literal"><span class="pre">FormattedEntry</span></code> objects
and some additional metadata.</p>
</li>
<li><p class="first">The resulting <code class="xref py py-class docutils literal"><span class="pre">FormattedBibliography</span></code> is passed to the output
backend. The default backend is LaTeX. It can be changed with the <code class="docutils literal"><span class="pre">pybtex</span>
<span class="pre">--output-backend</span></code> option. The output backend converts the formatted
bibliography to the specific markup format and writes it to the output
file.</p>
</li>
</ol>
</div>
</div>
<div class="section" id="python-api">
<h2><a class="toc-backref" href="#id9">Python API</a><a class="headerlink" href="#python-api" title="Permalink to this headline">¶</a></h2>
<div class="section" id="the-base-interface">
<h3><a class="toc-backref" href="#id10">The base interface</a><a class="headerlink" href="#the-base-interface" title="Permalink to this headline">¶</a></h3>
<p>Both the Python engine and the BibTeX engine use the same interface
defined in <a class="reference internal" href="#pybtex.Engine" title="pybtex.Engine"><code class="xref py py-class docutils literal"><span class="pre">pybtex.Engine</span></code></a>.</p>
<p><a class="reference internal" href="#pybtex.Engine" title="pybtex.Engine"><code class="xref py py-class docutils literal"><span class="pre">pybtex.Engine</span></code></a> has a handful of methods but most of them are just
convenience wrappers for <a class="reference internal" href="#pybtex.Engine.format_from_files" title="pybtex.Engine.format_from_files"><code class="xref py py-meth docutils literal"><span class="pre">Engine.format_from_files()</span></code></a> that does the
actual job.</p>
<dl class="class">
<dt id="pybtex.Engine">
<em class="property">class </em><code class="descclassname">pybtex.</code><code class="descname">Engine</code><a class="headerlink" href="#pybtex.Engine" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt id="pybtex.Engine.make_bibliography">
<code class="descname">make_bibliography</code><span class="sig-paren">(</span><em>aux_filename</em>, <em>style=None</em>, <em>output_encoding=None</em>, <em>bib_format=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.Engine.make_bibliography" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the given <code class="docutils literal"><span class="pre">.aux</span></code> file and produce a formatted bibliography
using <a class="reference internal" href="#pybtex.Engine.format_from_files" title="pybtex.Engine.format_from_files"><code class="xref py py-meth docutils literal"><span class="pre">format_from_files()</span></code></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>style</strong> – If not <code class="docutils literal"><span class="pre">None</span></code>, use this style instead of specified in the <code class="docutils literal"><span class="pre">.aux</span></code> file.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pybtex.Engine.format_from_string">
<code class="descname">format_from_string</code><span class="sig-paren">(</span><em>bib_string</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.Engine.format_from_string" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse the bigliography data from the given string and produce a formated
bibliography using <a class="reference internal" href="#pybtex.Engine.format_from_files" title="pybtex.Engine.format_from_files"><code class="xref py py-meth docutils literal"><span class="pre">format_from_files()</span></code></a>.</p>
<p>This is a convenience method that calls
<a class="reference internal" href="#pybtex.Engine.format_from_strings" title="pybtex.Engine.format_from_strings"><code class="xref py py-meth docutils literal"><span class="pre">format_from_strings()</span></code></a> with a single string.</p>
</dd></dl>
<dl class="method">
<dt id="pybtex.Engine.format_from_strings">
<code class="descname">format_from_strings</code><span class="sig-paren">(</span><em>bib_strings</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.Engine.format_from_strings" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse the bigliography data from the given strings and produce a formated
bibliography.</p>
<p>This is a convenience method that wraps each string into a StringIO,
then calls <a class="reference internal" href="#pybtex.Engine.format_from_files" title="pybtex.Engine.format_from_files"><code class="xref py py-meth docutils literal"><span class="pre">format_from_files()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="pybtex.Engine.format_from_file">
<code class="descname">format_from_file</code><span class="sig-paren">(</span><em>filename</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.Engine.format_from_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the bigliography data from the given file and produce a formated
bibliography.</p>
<p>This is a convenience method that calls <a class="reference internal" href="#pybtex.Engine.format_from_files" title="pybtex.Engine.format_from_files"><code class="xref py py-meth docutils literal"><span class="pre">format_from_files()</span></code></a>
with a single file. All extra arguments are passed to
<a class="reference internal" href="#pybtex.Engine.format_from_files" title="pybtex.Engine.format_from_files"><code class="xref py py-meth docutils literal"><span class="pre">format_from_files()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="pybtex.Engine.format_from_files">
<code class="descname">format_from_files</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.Engine.format_from_files" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the bigliography data from the given files and produce a formated
bibliography.</p>
<p>This is an abstract method overridden by both
<a class="reference internal" href="#pybtex.PybtexEngine" title="pybtex.PybtexEngine"><code class="xref py py-class docutils literal"><span class="pre">pybtex.PybtexEngine</span></code></a> and <a class="reference internal" href="#pybtex.bibtex.BibTeXEngine" title="pybtex.bibtex.BibTeXEngine"><code class="xref py py-class docutils literal"><span class="pre">pybtex.bibtex.BibTeXEngine</span></code></a>.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="the-bibtexengine-class">
<span id="bibtex-engine-api"></span><h3><a class="toc-backref" href="#id11">The BibTeXEngine class</a><a class="headerlink" href="#the-bibtexengine-class" title="Permalink to this headline">¶</a></h3>
<p>The BibTeX engine lives in the <code class="docutils literal"><span class="pre">pybtex.bibtex</span></code> module.
The public interface consists of the <a class="reference internal" href="#pybtex.bibtex.BibTeXEngine" title="pybtex.bibtex.BibTeXEngine"><code class="xref py py-class docutils literal"><span class="pre">BibTeXEngine</span></code></a> class and a
couple of convenience functions.</p>
<dl class="class">
<dt id="pybtex.bibtex.BibTeXEngine">
<em class="property">class </em><code class="descclassname">pybtex.bibtex.</code><code class="descname">BibTeXEngine</code><a class="headerlink" href="#pybtex.bibtex.BibTeXEngine" title="Permalink to this definition">¶</a></dt>
<dd><p>The Python fomatting engine.</p>
<p>See <a class="reference internal" href="#pybtex.Engine" title="pybtex.Engine"><code class="xref py py-class docutils literal"><span class="pre">pybtex.Engine</span></code></a> for inherited methods.</p>
<dl class="method">
<dt id="pybtex.bibtex.BibTeXEngine.format_from_files">
<code class="descname">format_from_files</code><span class="sig-paren">(</span><em>bib_files_or_filenames, style, citations=['*'], bib_format=None, bib_encoding=None, output_encoding=None, bst_encoding=None, min_crossrefs=2, output_filename=None, add_output_suffix=False, **kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.bibtex.BibTeXEngine.format_from_files" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the bigliography data from the given files and produce a formated
bibliography.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>bib_files_or_filenames</strong> – A list of file names or file objects.</li>
<li><strong>style</strong> – The name of the formatting style.</li>
<li><strong>citations</strong> – A list of citation keys.</li>
<li><strong>bib_format</strong> – The name of the bibliography format. The default
format is <code class="docutils literal"><span class="pre">bibtex</span></code>.</li>
<li><strong>bib_encoding</strong> – Encoding of bibliography files.</li>
<li><strong>output_encoding</strong> – Encoding that will be used by the output backend.</li>
<li><strong>bst_encoding</strong> – Encoding of the <code class="docutils literal"><span class="pre">.bst</span></code> file.</li>
<li><strong>min_crossrefs</strong> – Include cross-referenced entries after this many
crossrefs. See BibTeX manual for details.</li>
<li><strong>output_filename</strong> – If <code class="docutils literal"><span class="pre">None</span></code>, the result will be returned as a
string. Else, the result will be written to the specified file.</li>
<li><strong>add_output_suffix</strong> – Append a <code class="docutils literal"><span class="pre">.bbl</span></code> suffix to the output file name.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="pybtex.bibtex.make_bibliography">
<code class="descclassname">pybtex.bibtex.</code><code class="descname">make_bibliography</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.bibtex.make_bibliography" title="Permalink to this definition">¶</a></dt>
<dd><p>A convenience function that calls <code class="xref py py-meth docutils literal"><span class="pre">BibTeXEngine.make_bibliography()</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="pybtex.bibtex.format_from_string">
<code class="descclassname">pybtex.bibtex.</code><code class="descname">format_from_string</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.bibtex.format_from_string" title="Permalink to this definition">¶</a></dt>
<dd><p>A convenience function that calls <code class="xref py py-meth docutils literal"><span class="pre">BibTeXEngine.format_from_string()</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="pybtex.bibtex.format_from_strings">
<code class="descclassname">pybtex.bibtex.</code><code class="descname">format_from_strings</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.bibtex.format_from_strings" title="Permalink to this definition">¶</a></dt>
<dd><p>A convenience function that calls <code class="xref py py-meth docutils literal"><span class="pre">BibTeXEngine.format_from_strings()</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="pybtex.bibtex.format_from_file">
<code class="descclassname">pybtex.bibtex.</code><code class="descname">format_from_file</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.bibtex.format_from_file" title="Permalink to this definition">¶</a></dt>
<dd><p>A convenience function that calls <code class="xref py py-meth docutils literal"><span class="pre">BibTeXEngine.format_from_file()</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="pybtex.bibtex.format_from_files">
<code class="descclassname">pybtex.bibtex.</code><code class="descname">format_from_files</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.bibtex.format_from_files" title="Permalink to this definition">¶</a></dt>
<dd><p>A convenience function that calls <a class="reference internal" href="#pybtex.bibtex.BibTeXEngine.format_from_files" title="pybtex.bibtex.BibTeXEngine.format_from_files"><code class="xref py py-meth docutils literal"><span class="pre">BibTeXEngine.format_from_files()</span></code></a>.</p>
</dd></dl>
</div>
<div class="section" id="the-pybtexengine-class">
<h3><a class="toc-backref" href="#id12">The PybtexEngine class</a><a class="headerlink" href="#the-pybtexengine-class" title="Permalink to this headline">¶</a></h3>
<p>The Python engine resides in the <code class="docutils literal"><span class="pre">pybtex</span></code> module
and uses an interface similar to the <a class="reference internal" href="#bibtex-engine-api"><span>BibTeX engine</span></a>.
There is the <a class="reference internal" href="#pybtex.PybtexEngine" title="pybtex.PybtexEngine"><code class="xref py py-class docutils literal"><span class="pre">PybtexEngine</span></code></a> class and some convenience functions.</p>
<dl class="class">
<dt id="pybtex.PybtexEngine">
<em class="property">class </em><code class="descclassname">pybtex.</code><code class="descname">PybtexEngine</code><a class="headerlink" href="#pybtex.PybtexEngine" title="Permalink to this definition">¶</a></dt>
<dd><p>The Python fomatting engine.</p>
<p>See <a class="reference internal" href="#pybtex.Engine" title="pybtex.Engine"><code class="xref py py-class docutils literal"><span class="pre">pybtex.Engine</span></code></a> for inherited methods.</p>
<dl class="method">
<dt id="pybtex.PybtexEngine.format_from_files">
<code class="descname">format_from_files</code><span class="sig-paren">(</span><em>bib_files_or_filenames, style, citations=['*'], bib_format=None, bib_encoding=None, output_backend=None, output_encoding=None, min_crossrefs=2, output_filename=None, add_output_suffix=False, **kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.PybtexEngine.format_from_files" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the bigliography data from the given files and produce a formated
bibliography.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>bib_files_or_filenames</strong> – A list of file names or file objects.</li>
<li><strong>style</strong> – The name of the formatting style.</li>
<li><strong>citations</strong> – A list of citation keys.</li>
<li><strong>bib_format</strong> – The name of the bibliography format. The default
format is <code class="docutils literal"><span class="pre">bibtex</span></code>.</li>
<li><strong>bib_encoding</strong> – Encoding of bibliography files.</li>
<li><strong>output_backend</strong> – Which output backend to use. The default is <code class="docutils literal"><span class="pre">latex</span></code>.</li>
<li><strong>output_encoding</strong> – Encoding that will be used by the output backend.</li>
<li><strong>bst_encoding</strong> – Encoding of the <code class="docutils literal"><span class="pre">.bst</span></code> file.</li>
<li><strong>min_crossrefs</strong> – Include cross-referenced entries after this many
crossrefs. See BibTeX manual for details.</li>
<li><strong>output_filename</strong> – If <code class="docutils literal"><span class="pre">None</span></code>, the result will be returned as a
string. Else, the result will be written to the specified file.</li>
<li><strong>add_output_suffix</strong> – Append default suffix to the output file
name (<code class="docutils literal"><span class="pre">.bbl</span></code> for LaTeX, <code class="docutils literal"><span class="pre">.html</span></code> for HTML, etc.).</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="pybtex.make_bibliography">
<code class="descclassname">pybtex.</code><code class="descname">make_bibliography</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.make_bibliography" title="Permalink to this definition">¶</a></dt>
<dd><p>A convenience function that calls <code class="xref py py-meth docutils literal"><span class="pre">PybtexEngine.make_bibliography()</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="pybtex.format_from_string">
<code class="descclassname">pybtex.</code><code class="descname">format_from_string</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.format_from_string" title="Permalink to this definition">¶</a></dt>
<dd><p>A convenience function that calls <code class="xref py py-meth docutils literal"><span class="pre">PybtexEngine.format_from_string()</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="pybtex.format_from_strings">
<code class="descclassname">pybtex.</code><code class="descname">format_from_strings</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.format_from_strings" title="Permalink to this definition">¶</a></dt>
<dd><p>A convenience function that calls <code class="xref py py-meth docutils literal"><span class="pre">PybtexEngine.format_from_strings()</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="pybtex.format_from_file">
<code class="descclassname">pybtex.</code><code class="descname">format_from_file</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.format_from_file" title="Permalink to this definition">¶</a></dt>
<dd><p>A convenience function that calls <code class="xref py py-meth docutils literal"><span class="pre">PybtexEngine.format_from_file()</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="pybtex.format_from_files">
<code class="descclassname">pybtex.</code><code class="descname">format_from_files</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#pybtex.format_from_files" title="Permalink to this definition">¶</a></dt>
<dd><p>A convenience function that calls <a class="reference internal" href="#pybtex.PybtexEngine.format_from_files" title="pybtex.PybtexEngine.format_from_files"><code class="xref py py-meth docutils literal"><span class="pre">PybtexEngine.format_from_files()</span></code></a>.</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="prev-next">
<div class="left">
<a href="parsing.html">← Reading and writing bibliography data</a>
</div>
<div class="middle">
<a href="../index.html">Table of contents</a>
</div>
<div class="right">
<a href="styles.html">Designing styles →</a>
</div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2015, Andrey Golovizin.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.6.
</div>
</div>
</body>
</html>
|