def latex(self, aliases=None):
self._initialize_latex_array(aliases)<EOL>self._build_latex_array(aliases)<EOL>header_1 = r"""<STR_LIT>"""% instead and customize the height and width (in cm) to fit.<EOL>images may run out of memory quickly.<EOL><INDENT>this use the LuaLaTeX compiler, which dynamically<EOL><DEDENT>tes memory.<EOL>age[braket, qm]{qcircuit}<EOL>age{amsmath}<EOL>ile{+sansmathaccent.map}<EOL>ckage[landscape]{geometry}<EOL>t out the above line if using the beamer documentclass.<EOL>ocument}<EOL>quation*}"""<STR_LIT>"""<EOL>rcuit @C=%<NUM_LIT>fem @R=%<NUM_LIT>fem @!R {<EOL>output = io.StringIO()<EOL>output.write(header_1)<EOL>output.write('<STR_LIT>' % (self.img_width, self.img_depth))<EOL>output.write(beamer_line % self._get_beamer_page())<EOL>output.write(header_2)<EOL>output.write(qcircuit_line %<EOL><INDENT>(self.column_separation, self.row_separation))<EOL>for i in range(self.img_width):<EOL>output.write("<STR_LIT>")<EOL>for j in range(self.img_depth + <NUM_LIT:1>):<EOL>cell_str = self._latex[i][j]<EOL>if '<STR_LIT>' in cell_str:<EOL>output.write(cell_str)<EOL>else:<EOL>cell_str = re.sub(r'<STR_LIT>',<EOL><INDENT>_truncate_float,<EOL>cell_str)<EOL>output.write(cell_str)<EOL>if j != self.img_depth:<EOL>output.write("<STR_LIT>")<EOL>else:<EOL>output.write(r'<STR_LIT:\\>' + '<STR_LIT:\n>')<EOL>output.write('<STR_LIT>')<EOL>output.write('<STR_LIT>')<EOL>output.write('<STR_LIT>')<EOL>contents = output.getvalue()<EOL>output.close()<EOL>return contents<EOL>
Return LaTeX string representation of circuit.

        This method uses the LaTeX Qconfig package to create a graphical
        representation of the circuit.

        Returns:
            string: for writing to a LaTeX file.