4.6.3. B2Tools¶
-
class
B2Tools.b2latex.
DefineColourList
[source]¶ Bases:
B2Tools.b2latex.LatexObject
Defines the colourlist latex-command, which draws a bargraph with relative fractions indicated by colours using tikz. After including this object in you latex code the command bargraph is available. You should include only one of these objects in your latex code.
-
colours
= ['red', 'green', 'blue', 'orange', 'cyan', 'purple']¶ 6 default colours used for the bargraph
-
-
class
B2Tools.b2latex.
Graphics
[source]¶ Bases:
B2Tools.b2latex.LatexObject
Includes a series of image files into your latex code and centers them.
-
class
B2Tools.b2latex.
Itemize
[source]¶ Bases:
B2Tools.b2latex.LatexObject
Creates a itemized list in latex.
-
add
(item)[source]¶ Adds another item.
- Parameters
item – string or object with implicit string conversion used as item
-
amount
= None¶ number of items
-
-
class
B2Tools.b2latex.
LatexFile
[source]¶ Bases:
B2Tools.b2latex.LatexObject
Convinience class implementing += operator, can be used instead of raw LatexObject to collect all the latex code in your project which should go into a common file.
-
class
B2Tools.b2latex.
LatexObject
[source]¶ Bases:
object
Common base class of all Latex Wrapper objects
-
add
()[source]¶ Add latex-code to the output string. This method is usually overriden in the subclasses
-
finish
()[source]¶ Finishes the generation of latex-code. E.g. adds end latex-commands This method is usually overriden in the subclasses
-
output
= None¶ Stores the outputted latex-code
-
-
class
B2Tools.b2latex.
Listing
(language='XML')[source]¶ Bases:
B2Tools.b2latex.LatexObject
Used for wrapping code in a listing environment
-
class
B2Tools.b2latex.
LongTable
(columnspecs, caption, format_string, head)[source]¶ Bases:
B2Tools.b2latex.LatexObject
Creates a longtable in latex. A longtable can span multiple pages and is automatically wrapped.
-
add
(*args, **kwargs)[source]¶ Add a new row to the longtable by generating the row using the format_string given in init and the provided dictionary.
- Parameters
args – positional arguments used to generate the row using the python-style format string.
kwargs – dictionary used to generate the row using the python-style format-string.
-
finish
(tail='')[source]¶ Adds optional tail of the table, ends longtable and centered environment.
- Parameters
tail – optional tail, like head but at the bottom of the table.
-
format_string
= None¶ python-style format-string used to generate a new row out of a given dictionary.
-
-
class
B2Tools.b2latex.
Section
(name)[source]¶ Bases:
B2Tools.b2latex.LatexObject
Adds a new section to your latex code with some additional commands to force a pagebreak and add a barrier for figure objects.
-
class
B2Tools.b2latex.
String
(text='')[source]¶ Bases:
B2Tools.b2latex.LatexObject
Used for wrapping conventionel text into latex-code. Has to possibility to handle python-style format-placeholders
-
class
B2Tools.b2latex.
SubSection
(name)[source]¶ Bases:
B2Tools.b2latex.LatexObject
Adds a new subsection to your latex code.
-
class
B2Tools.b2latex.
SubSubSection
(name)[source]¶ Bases:
B2Tools.b2latex.LatexObject
Adds a new subsubsection to your latex code.
-
class
B2Tools.b2latex.
TitlePage
(title, authors, abstract, add_table_of_contents=True, clearpage=True)[source]¶ Bases:
B2Tools.b2latex.LatexObject
Creates a latex title-page and optionally abstract and table-of-contents. You should include only one of these objects in your latex code.
-
class
B2Tools.format.
AttrDict
(content)[source]¶ Bases:
object
Simple wrapper class to allow accessing dictionary elements via attribute access
-
class
B2Tools.format.
DefaultValueFormatter
[source]¶ Bases:
string.Formatter
Custom formatter class which allows to substitute a missing value with a default value
-
B2Tools.format.
decayDescriptor
(decay_string)[source]¶ Prettifies the given decay string by using latex-symbols instead of plain-text
- Parameters
decay_string – string containing a decay descriptor
- Returns
string latex version of the decay descriptor
-
B2Tools.format.
duration
(seconds)[source]¶ Converts a duration given in seconds into a nice latex-style duration string
- Parameters
seconds – duration in seconds
- Returns
string describing a duration in a natural format
-
B2Tools.format.
format_filename
(template, filename, metadata_json)[source]¶ Format a file name as described in BELLE2-NOTE-TE-2017-012