[PLUG-TALK] How to get Latex to do my math for me

Rich Shepard rshepard at appl-ecosys.com
Wed Jan 8 02:16:15 UTC 2020


On Tue, 7 Jan 2020, John Jason Jordan wrote:

> I'm trying to create a table and have Latex calculate the width of the
> columns, based on the fact that the table will be 568.8 points wide and
> there will be two columns. The following blows up on me:
>
> \begin{tabular}{|p{568.8/2pt}|p{568.8/2pt}|}
> \hline \hline
>
> If I change the 568.8/2pt to 284.4pt it works fine.
>
> I thought of doing the math prior to the table with something like 'let
> x=568.8/2' and then just say xpt. But I don't know how to do that, and
> it probably wouldn't work anyway.

John,

I offer two suggestions. First, install LyX and use that rather than
straight LaTeX. Much easier and quicker.

Second. if you are using letter paper and have 1" margins on each side the
text area is 6.5". Since we're used to thinking in terms of inches (or
centimeters) rather than points set column widths using inches. You can futz
with them (a.k.a. trial-and-error) and use the dvips page preview to see how
it all looks.

If the table is long you can specify multitable and it will continue across
as many pages as needed. Or, if it's only a few rows but wider than the
portrait text area you can rotate the table 90 degrees and have it presented
in landscape mode. (This will not been seen in the preview but will be in
the compiled output.)

HTH,

Rich




More information about the PLUG-talk mailing list