'Generate a latex representation of the quantity and its unit.
The behavior of this function can be altered via the
`numpy.set_printoptions` function and its various keywords.  The
exception to this is the ``threshold`` keyword, which is controlled via
the ``[units.quantity]`` configuration item ``latex_array_threshold``.
This is treated separately because the numpy default of 1000 is too big
for most browsers to handle.
Returns
lstr
A LaTeX string with the contents of this Quantity'

def _repr_latex_(self):

    pops = np.get_printoptions()
    try:
        formatter = {u'float_kind': Latex.format_exponential_notation}
        if (conf.latex_array_threshold > (-1)):
            np.set_printoptions(threshold=conf.latex_array_threshold, formatter=formatter)
        latex_value = np.array2string(self.view(np.ndarray), style=(Latex.format_exponential_notation if (self.dtype.kind == u'f') else repr), max_line_width=np.inf, separator=u',~')
        latex_value = latex_value.replace(u'...', u'\\dots')
    finally:
        np.set_printoptions(**pops)
    latex_unit = (self.unit._repr_latex_()[1:(-1)] if (self.unit is not None) else _UNIT_NOT_INITIALISED)
    return u'${0}    \\;    {1}$'.format(latex_value, latex_unit)
