quairkit.core.latex¶
Source file for transforming OperatorInfo to string representing quantikz.
Quantikz is a LaTeX package for typesetting quantum circuit diagrams. See https://ctan.org/pkg/quantikz for more details.
-
quairkit.core.latex.code_to_str(code, begin_code=
None
)¶ Translate the given quantikz code into complete LaTeX commands
- class quairkit.core.latex.OperatorListDrawer(style, decimals)¶
Latex plot for a list of operators in QuAIRKit
Note
The LaTeX package used is [quantikz](https://ctan.org/pkg/quantikz).
- fill_all()¶
Fill empty &s for all lines covered by the current codes
- clone()¶
Clone the current drawer
- property code : dict[int, list[str]]¶
The dictionary of the current circuit code
Note
Empty lines are filled with ‘{}’
-
add_end(rstick_str=
None
)¶ Add end sticks to the circuit
-
plot(dpi=
300
, print_code=True
, begin_code=None
)¶ Plot the given quantikz code using LaTeX
- append(info)¶
Append an operator to the current circuit code
- Parameters:¶
- info : OperatorInfoType¶
The information of the operator to append
-
draw_layer(list_info, name, depth=
1
)¶ Give the drawer for a layer, i.e., a list of operators
- Parameters:¶
- list_info : List[OperatorInfoType]¶
The list of operators to draw
- name : str¶
The name of the layer.
- depth : int¶
The depth of the layer. Defaults to 1.
Note
if name is given, the layer name will be added to the code by - command ‘gate’ with layer name if the style is ‘compact’; - command ‘gate’ with matrix if the style is ‘detailed’ and matrix is given. - command ‘gategroup’ with name above if the style is ‘standard’;