Re: psql latex and newlines

From: "Harvey, Allan AC" <HarveyA(at)OneSteel(dot)com>
To: Wim Bertels <wim(dot)bertels(at)khleuven(dot)be>, Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql latex and newlines
Date: 2012-02-24 00:00:46
Message-ID: B25A2A1F79570045813EE68917222A20024F56@HSTMBX02.onesteel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Wim Bertels
> Sent: Friday, 24 February 2012 2:46 AM
> To: Bruce Momjian
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] psql latex and newlines
>
> > > > > the problem arises when u have a field value that
> contains a newline
> > > > > character, when this field is not the first column,
> then all the data
> > > > > after this newline comes in the first column..
> > > > >
> > > > > u can try this out, writing a function or table,
> > > > > and then add 'enters' or newline in the COMMENT on
> this function or
> > > > > table.
> > > > >
>
> > >
> > > There is also a problem with long lines as u can test by
> uncommenting
> > > the t4bruce3 function.
> >
> > Well, I was hoping you could tell me exactly how you wanted
> the behavior
> > changed and I could try to implement it in psql. I am
> afraid I don't
> > know enough about TeX to understand the isssue involved.
> >
>
> Hi Bruce,
>
> the option i came across is the usage of \pbox,
> so the suggestion would be to put every field/cell inside a pbox.
>
> Instead of
> \begin{tabular}{l | l | l}
> \textit{Schema} & \textit{Name} & \textit{Description} \\
> \hline
> latex\_test & t4bruce1 & This function and so on enter\\
> another enter,\
> \ just one more.\\ \\
> latex\_test & t4bruce2 & This function and so on enter\\
> another enter,\
> \ just one more,\\ so now have even one more.\\ \\
> \end{tabular}
>
> the generated code could like:
> \begin{tabular}{l | l | l}
> \textit{Schema} & \textit{Name} & \textit{Description} \\
> \hline
> \pbox{\textwidth}{latex\_test} & \pbox{\textwidth}{t4bruce1} &
> \pbox{\textwidth}{This function and so on enter\\ another
> enter,\\ just
> one more.\\} \\
> \pbox{\textwidth}{latex\_test} & \pbox{\textwidth}{t4bruce2} &
> \pbox{\textwidth}{This function and so on enter\\ another
> enter,\\ just
> one more,\\ so now have even one more.\\} \\
> \end{tabular}
>
> Comments:
> - the improvement is that now newlines inside boxes stay inside these
> boxes (or cells/fields), it is not a complete solution as very long
> lines are not automatically formatted into several lines inside a box,
> but if necessary the db-user can do a a search and replace in the
> generated tex code s\textwidth\20cm for example, makes every
> box 20cm at
> maximum. (maybe to be put in the docu somewhere as a comment on
> textwidth). This all depends on the page format,
> unfortunately (for now?
> in latex) the nice (p)aragraph formatting doesn't fully
> extend inside a
> table (cf tabular)
> - i'm not a tex specialist, but also the people i know didn't find a
> better solution
>
> mvg,
> Wim
>

My 2 cents worth is I would like to see the booktabs and longtable environments used to handle pages covering multiple pages. I have attached a zip containg a pdf of the different versions, the LaTex source.
The example is recast and extracted here:

Allan

\begin{longtable}{p{0.3\textwidth}p{0.3\textwidth}p{0.3\textwidth}}
\toprule
\centering{\small\textbf{\textit{Schema}}} & \small\textbf{\textit{Name}} & \small\textbf{\textit{Description}} \\
\midrule \\
\endfirsthead
\toprule
\centering{\small\textbf{\textit{Schema}}} & \small\textbf{\textit{Name}} & \small\textbf{\textit{Description}} \\
\midrule \\
\endhead

\bottomrule \\
\caption[List of Tables Entry. (Continued)]{Bottom Caption.}
\endfoot

\bottomrule \\
\caption[List of Tables Entry.]{Bottom Caption.}
\endlastfoot

% Table Entries
\raggedright{latex\_test}
&
\raggedright{t4bruce1}
&
\raggedright{This function and so on enter \\ another enter,\\ just one more.} \tabularnewline \\

\raggedright{latex\_test}
&
\raggedright{t4bruce1}
&
\raggedright{This function and so on enter \\ another enter,\\ just one more,\\ so now have even one more.} \tabularnewline \\

\end{longtable}

The material contained in this email may be confidential, privileged or copyrighted. If you are not the intended recipient, use, disclosure or copying of this information is prohibited. If you have received this document in error, please advise the sender and delete the document. Neither OneSteel nor the sender accept responsibility for any viruses contained in this email or any attachments.

Attachment Content-Type Size
psqlTeXtables.zip application/x-zip-compressed 25.6 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dmytrii Nagirniak 2012-02-24 00:16:33 Re: Optimise PostgreSQL for fast testing
Previous Message Dmytrii Nagirniak 2012-02-24 00:00:08 Re: Optimise PostgreSQL for fast testing