[Tex/LaTex] Align table caption with left border of longtable

captionshorizontal alignmentlongtabletables

Subj.

I cannot use singlelinecheck=off because it aligns it to the left border of the page.
And why table is too narrow?

\documentclass[12pt,a4paper,oneside]{article}
\usepackage[left=35mm,right=15mm,top=2cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage[utf8x]{inputenc} % указать кодировку русского текста
\usepackage[russian]{babel} % указать, что язык текста - русский

\usepackage{cmap}

\usepackage{makeidx}
\makeindex

\usepackage{indentfirst} 
\setlength{\parindent}{1.25cm}

\usepackage{caption}
\captionsetup[table]{labelsep=endash}

\usepackage{ltablex}
\usepackage{lipsum}
\begin{document}
    \keepXColumns
        \begin{tabularx}{\textwidth}{| l | X |} 

        \caption{A long description of this awesomest table ever. No, seriously.}\\
        \hline 
        First & Second\\ \hline \hline
        \endfirsthead
        \captionsetup{singlelinecheck=off}
        \caption{A short one}\\
        \hline 
        First & Second\\ \hline
        \endhead
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        \end{tabularx}
\end{document}

Best Answer

I don't know why the table doesn't stretch. But here's an alternative, replacing ltablex with the more recent longtabu environment. Another longtabu example directly compared to an ltablex one can be found in the answer to Ltablex customize caption.

\documentclass[12pt,a4paper,oneside]{article}
\usepackage[left=35mm,right=15mm,top=2cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage[utf8x]{inputenc} % указать кодировку русского текста
\usepackage[russian]{babel} % указать, что язык текста - русский

\usepackage{cmap}

\usepackage{makeidx}
\makeindex

\usepackage{indentfirst} 
\setlength{\parindent}{1.25cm}

\usepackage{caption}
\captionsetup[table]{labelsep=endash}

\usepackage{longtable}
\usepackage{tabu}
\usepackage{lipsum}
\begin{document}
%    \keepXColumns
        \begin{longtabu} to \textwidth {| l | X |} 

        \caption{A long description of this awesomest table ever. No, seriously. Worth repeating: A long description of this awesomest table ever. No, seriously. }\\
        \hline 
        First & Second\\ \hline \hline
        \endfirsthead
        \captionsetup{singlelinecheck=off}
        \caption{A short one}\\
        \hline 
        First & Second\\ \hline
        \endhead
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        Lols & \lipsum[150] \\ \hline
        \end{longtabu}
\end{document}