Belle II Software development
LongTable Class Reference
Inheritance diagram for LongTable:
LatexObject

Public Member Functions

def __init__ (self, columnspecs, caption, format_string, head)
 
def add (self, *args, **kwargs)
 
def finish (self, tail='')
 

Public Attributes

 format_string
 python-style format-string used to generate a new row out of a given dictionary.
 

Detailed Description

Creates a longtable in latex. A longtable can span multiple pages
and is automatically wrapped.

Definition at line 377 of file b2latex.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  columnspecs,
  caption,
  format_string,
  head 
)
Calls super-class init, begins centered environment and longtable environment.
Defines caption and head of the table.
    @param columnspecs of the longtable, something like:
            rclp{7cm} 4 columns, right-center-left aligned and one paragraph column with a width of 7cm
    @param caption string or object with implicit string conversion used as caption.
    @param format_string  python-style format-string used to generate a new row out of a given dictionary.
    @param head of the table

Reimplemented from LatexObject.

Definition at line 383 of file b2latex.py.

383 def __init__(self, columnspecs, caption, format_string, head):
384 """
385 Calls super-class init, begins centered environment and longtable environment.
386 Defines caption and head of the table.
387 @param columnspecs of the longtable, something like:
388 rclp{7cm} 4 columns, right-center-left aligned and one paragraph column with a width of 7cm
389 @param caption string or object with implicit string conversion used as caption.
390 @param format_string python-style format-string used to generate a new row out of a given dictionary.
391 @param head of the table
392 """
393 super().__init__()
394 self.output += r"\begin{center}" + '\n'
395 self.output += r"\begin{longtable}{" + str(columnspecs) + r"}" + '\n'
396 self.output += r"\caption{" + str(caption) + r"}\\" + '\n'
397 self.output += r"\toprule" + '\n'
398 self.output += head + r"\\" + '\n'
399 self.output += r"\midrule" + '\n'
400
401 self.format_string = format_string
402

Member Function Documentation

◆ add()

def add (   self,
args,
**  kwargs 
)
Add a new row to the longtable by generating the row using the format_string given in init
and the provided dictionary.
    @param args positional arguments used to generate the row using the python-style format string.
    @param kwargs dictionary used to generate the row using the python-style format-string.

Reimplemented from LatexObject.

Definition at line 403 of file b2latex.py.

403 def add(self, *args, **kwargs):
404 """
405 Add a new row to the longtable by generating the row using the format_string given in init
406 and the provided dictionary.
407 @param args positional arguments used to generate the row using the python-style format string.
408 @param kwargs dictionary used to generate the row using the python-style format-string.
409 """
410 self.output += self.format_string.format(*args, **kwargs) + r"\\" + '\n'
411 return self
412

◆ finish()

def finish (   self,
  tail = '' 
)
Adds optional tail of the table, ends longtable and centered environment.
    @param tail optional tail, like head but at the bottom of the table.

Reimplemented from LatexObject.

Definition at line 413 of file b2latex.py.

413 def finish(self, tail=''):
414 """
415 Adds optional tail of the table, ends longtable and centered environment.
416 @param tail optional tail, like head but at the bottom of the table.
417 """
418 self.output += r"\bottomrule" + '\n'
419 if str(tail) != '':
420 self.output += str(tail) + r"\\" + '\n'
421 self.output += r"\bottomrule" + '\n'
422 self.output += r"\end{longtable}" + '\n'
423 self.output += r"\end{center}" + '\n'
424 return self
425
426

Member Data Documentation

◆ format_string

format_string

python-style format-string used to generate a new row out of a given dictionary.

Definition at line 401 of file b2latex.py.


The documentation for this class was generated from the following file: