Repository: Qiskit/qiskit

Issue:
latex drawer: missing gates and params
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues -->

### Information

- **Qiskit Terra version**:
- **Python version**:
- **Operating system**:

### What is the current behavior?
```python
from qiskit import QuantumRegister, QuantumCircuit

qr = QuantumRegister(3)
qc = QuantumCircuit(qr)

qc.h(qr[0])
qc.cu1(0.1, qr[1], qr[0])
qc.cu1(0.2, qr[2], qr[0])
qc.h(qr[1])
qc.cu1(0.3, qr[1], qr[2])
qc.h(qr[2])

qc.draw(output='latex')
```

results in two missing hadamards and a missing parameter (0.1)
![image](https://user-images.githubusercontent.com/8622381/57479791-40c1fc00-726c-11e9-9d23-dc938c1d0867.png)


The culprit is #1977. Before that commit, it shows correctly (except for the bad spacing which is a separate issue (#693):
![image](https://user-images.githubusercontent.com/8622381/57479869-71099a80-726c-11e9-9d6e-d8ecc5351daf.png)





Discussion:
@maddy-tod can you take a look please?

Resolving patch:
diff --git a/qiskit/visualization/latex.py b/qiskit/visualization/latex.py
--- a/qiskit/visualization/latex.py
+++ b/qiskit/visualization/latex.py
@@ -256,8 +256,9 @@ def _get_image_depth(self):
 
         # wires in the beginning and end
         columns = 2
-        # each layer is one column
-        columns += len(self.ops)
+
+        # all gates take up 1 column except from those with labels (cu1) which take 2
+        columns += sum([2 if nd.name == 'cu1' else 1 for layer in self.ops for nd in layer])
 
         # every 3 characters is roughly one extra 'unit' of width in the cell
         # the gate name is 1 extra 'unit'
@@ -328,7 +329,10 @@ def _build_latex_array(self, aliases=None):
         else:
             qregdata = self.qregs
 
-        for column, layer in enumerate(self.ops, 1):
+        column = 1
+        for layer in self.ops:
+            num_cols_used = 1
+
             for op in layer:
                 if op.condition:
                     mask = self._get_mask(op.condition[0])
@@ -504,12 +508,15 @@ def _build_latex_array(self, aliases=None):
                                 self._latex[pos_2][column] = \
                                     "\\gate{R_z(%s)}" % (op.op.params[0])
                             elif nm == "cu1":
-                                self._latex[pos_1][column - 1] = "\\ctrl{" + str(
+                                self._latex[pos_1][column] = "\\ctrl{" + str(
                                     pos_2 - pos_1) + "}"
-                                self._latex[pos_2][column - 1] = "\\control\\qw"
-                                self._latex[min(pos_1, pos_2)][column] = \
+                                self._latex[pos_2][column] = "\\control \\qw"
+                                self._latex[min(pos_1, pos_2)][column + 1] = \
                                     "\\dstick{%s}\\qw" % (op.op.params[0])
-                                self._latex[max(pos_1, pos_2)][column] = "\\qw"
+                                self._latex[max(pos_1, pos_2)][column + 1] = "\\qw"
+                                # this is because this gate takes up 2 columns,
+                                # and we have just written to the next column
+                                num_cols_used = 2
                             elif nm == "cu3":
                                 self._latex[pos_1][column] = \
                                     "\\ctrl{" + str(pos_2 - pos_1) + "}"
@@ -547,12 +554,13 @@ def _build_latex_array(self, aliases=None):
                                 self._latex[pos_2][column] = \
                                     "\\gate{R_z(%s)}" % (op.op.params[0])
                             elif nm == "cu1":
-                                self._latex[pos_1][column - 1] = "\\ctrl{" + str(
+                                self._latex[pos_1][column] = "\\ctrl{" + str(
                                     pos_2 - pos_1) + "}"
-                                self._latex[pos_2][column - 1] = "\\control\\qw"
-                                self._latex[min(pos_1, pos_2)][column] = \
+                                self._latex[pos_2][column] = "\\control \\qw"
+                                self._latex[min(pos_1, pos_2)][column + 1] = \
                                     "\\dstick{%s}\\qw" % (op.op.params[0])
-                                self._latex[max(pos_1, pos_2)][column] = "\\qw"
+                                self._latex[max(pos_1, pos_2)][column + 1] = "\\qw"
+                                num_cols_used = 2
                             elif nm == "cu3":
                                 self._latex[pos_1][column] = "\\ctrl{" + str(
                                     pos_2 - pos_1) + "}"
@@ -743,6 +751,9 @@ def _build_latex_array(self, aliases=None):
                 else:
                     raise exceptions.VisualizationError("bad node data")
 
+            # increase the number of columns by the number of columns this layer used
+            column += num_cols_used
+
     def _get_qubit_index(self, qubit):
         """Get the index number for a quantum bit
         Args:


Test patch: