Re: psql latex and newlines

From: Wim Bertels <wim(dot)bertels(at)khleuven(dot)be>
To: 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-23 15:46:29
Message-ID: 1330011989.3586.14.camel@zwerfkat
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > > > 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jack Christensen 2012-02-23 16:06:24 Re: Optimise PostgreSQL for fast testing
Previous Message Albe Laurenz 2012-02-23 15:43:34 Re: How to enable thread safety on postgresql 8.3.6