Re: psql latex and newlines - Mailing list pgsql-general

From Wim Bertels
Subject Re: psql latex and newlines
Date
Msg-id 1330011989.3586.14.camel@zwerfkat
Whole thread Raw
In response to Re: psql latex and newlines  (Bruce Momjian <bruce@momjian.us>)
Responses Re: psql latex and newlines
Re: psql latex and newlines
List 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







pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: How to enable thread safety on postgresql 8.3.6
Next
From: Jack Christensen
Date:
Subject: Re: Optimise PostgreSQL for fast testing