0

I have a loop that creates several longtable tex objects (using scala Tex view):

@for(o <- obj.pService) {

\sffamily
\ra{1.2}

\begin{longtable}{@{} l l l l @{}}
    \multicolumn{4}{l}{\large{\textbf{ @o.dept } }}\\
    \midrule
    \small{\textbf{Service}} & \small{\textbf{Price}} & 
    \small{\textbf{Quantity}} & \small{\textbf{Total}}\\

    @for(svc <- o.services) {
        \small{@svc.name} & \small{@svc.price} & \small{@svc.quantity} & 
        @for(p <- svc.price; q <- svc.quantity) {
            \small{@{"%1.2f".format(p * q)}}
        } \\
    }        
    \bottomrule
    \multicolumn{3}{l}{} & @( if (o.total.getOrElse("NULL") == "NULL") "" else "%1.2f".format( o.total.getOrElse(0f) )   ) \\
\end{longtable}


}

I need those longtable objects to be aligned to the left. I already tried \begin{flushleft} with no success as the generated tables appear at the center of the page.

2
  • Welcome to TeX.SE! Please provide a complete MWE, i.e. a document that starts with \documentclass, ends with \end{document}, can be compiled and illustrates the issue.
    – user121799
    Commented Oct 22, 2018 at 19:22
  • unrelated but size commands do not take an argument: \small{...} makes the rest of the document (or current environment) small, it does not just apply to the {...} Commented Oct 22, 2018 at 22:12

2 Answers 2

1

I just needed to use:

\setlength\LTleft{0pt}
\setlength\LTright{0pt}

from http://texdoc.net/texmf-dist/doc/latex/tools/longtable.pdf

2
  • or more simply just use \begin{longtable}[l] but also you might mention what programming language you are using in your question, as it clearly isn't tex. Commented Oct 22, 2018 at 22:11
  • setting both left and right to 0 will make every row of the table underfull. Commented Oct 23, 2018 at 0:52
1

longtable has on optional argument that specifies the alignment so you just need

\begin{longtable}[l]

to get a left aligned table.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .