def export_latex_array(self, words, symbol=r"s", cols=4):
    """Export a list words to latex array format.
       `cols` is the number of columns of the output latex array.

       Example: words = [(0, 1), (1, 2, 3) ...]
       Return: \begin{array}
               &s_0s_1 & s_1s_2s_3 & ... &\\
               ...
               \end{array}
    """
    def to_latex(word):
        return "".join(symbol + "_{{{}}}".format(i) for i in word)

    latex = ""
    for i, word in enumerate(words):
        if i > 0 and i % cols == 0:
            latex += r"\\" + "\n"
        latex += to_latex(word)
        if i % cols != cols - 1:
            latex += "&"

    return r"\begin{{array}}\n{{{}}}{}\n\end{{array}}".format("l" * cols, latex)