[Tex/LaTex] tables without tabular

tables

I'm having a lot of difficulty with the tabular environment. Granted, I'm trying to do a lot, including centering horizontally and vertically, using different fonts in different cells, and different font sizes in different cells.

Worst comes to worst, I can create the table as a picture file and then just embed it, but that puts a bad taste in my mouth because the end-user won't be able to text-search through it. Is there a different way to make tables other than the tabular environment? I want to experiment with other options. Other packages are fine of course.

If there's a way to start writing text at any coordinate on the page, that would be just fine. I could then use the drawing functions to draw lines making cells, then put text in there manually. It's not pretty, i mean it wouldn't automatically center or adjust to anything, but no big deal at this point.

For the record, I'm using Xelatex to compile on TexniCenter 2.02 64-bit with the MikTex distribution, on Windows 7 Pro 64 bit. Here's my current code for the table as it exists now. Sorry it's a bit of a mess.

    \setlength{\parindent}{0ex}
\begin{tabular}[c]{| p{1.85cm} | p{1.85cm} | p{1.85cm} | p{1.85cm} | p{1.85cm} | p{1.85cm} | p{1.85cm} |}
    \hline
     & \vspace{3mm} \cl{addition} & \vspace{3mm} \cl{subtraction} & \vspace{3mm} \cl{multiplication} & \vspace{3mm} \cl{division} & \vspace{3mm} \cl{exponentiation} & \vspace{3mm} \cl{rootification} \\ \hline 
    \vspace{3mm} \cl{Vortigenu} & \vspace{3mm} \cl{\VTGN{+}} & \vspace{3mm} \cl{\VTGN{-}} & \vspace{3mm} \cl{\VTGN{*}} & \vspace{3mm} \cl{\VTGN{/}} & \vspace{3mm} \cl{\VTGN{\char"5E}} & \vspace{3mm} \cl{\VTGN{\char"40}} \\ \hline
        \vspace{3mm} \cl{Earth} & \vspace{3mm} \cl{+} & \vspace{3mm} \cl{-} & \vspace{3mm} \cl{$\times$} & \vspace{3mm} \cl{$\div$} & \vspace{3mm} \cl{?} & \vspace{3mm} \cl{?} \\ \hline
\end{tabular}
\setlength{\parindent}{8ex}

The page is 28cm by 20 cm, with 2 cm margins on every side. Here are the 2 custom commands as defined in the top-level tex file.

\newcommand{\cl}[1]{\centerline{#1}}
\newcommand{\VTGN}[1]{\setmainfont{Vortigenu}{#1}\setmainfont{Times New Roman}}

Unfortunately, using \VTGN{} seems to create an extra blank line in every cell, making them thicker than necessary. This extra blank vertical space becomes proportionally bigger when i try to scale the font (using \scalefont{2}) of the vortigenu cells while keeping the other cells the same font size. BTW that only affects one cell, and all the others dont have bigger size even tho i never put in a \normalsize anywhere.

Best Answer

Don't engage in so much visual formatting. Instead, define some pertinent table parameters -- such as centering the column contents, the heights of the rows, etc -- beforehand, and then create a lean and reasonably easy to read table.

In the example below, I've created a dummy definition of your \VTGN macro to make the code compilable. You'll notice a complete absence of \vspace{3mm} and \cl directives in the code. Observe the use of \bigstrut to size the heights of the rows: it's an object with a depth of 4ex below the text baseline and a height of 6ex above the baseline. (The strut's total height is thus 10pt.) Adjust these parameters as needed to get the desired spacing. The strut's width is 0pt; hence it's not visible. One \bigstrut per row suffices.

enter image description here

\documentclass{article}
\usepackage[paperheight=28cm, paperwidth=20cm, margin=2cm]{geometry}
\newcommand\VTGN[1]{#1} %% just so that this example compiles
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\newcommand\bigstrut{\rule[-4ex]{0pt}{10ex}}
\begin{document}
\noindent
\begingroup
\setlength\tabcolsep{0.1pt} % default: 6pt
\begin{tabularx}{\textwidth}{ | *{7}{Y|} }
\hline
\bigstrut & addition & subtraction & multiplication & division & exponentiation & rootification \\ 
\hline 
Vortigenu \bigstrut & \VTGN{+} & \VTGN{-} & \VTGN{*} & \VTGN{/} & \VTGN{\char"5E} & \VTGN{\char"40} \\ 
\hline
Earth \bigstrut & + & $-$ & $\times$ & $\div$ & ? & ? \\ 
\hline
\end{tabularx}
\endgroup
\end{document}

Addendum: I just noticed that you posted the following definition of the \VTGN macro:

\newcommand{\VTGN}[1]{\setmainfont{Vortigenu}{#1}\setmainfont{Times New Roman}}

Using \setmainfont in this manner is rather inefficient as well as quite complex; see Section 5 of the user guide of the fontspec package for a more in-depth explanation of this claim. I suggest you provide the following commands in the preamble:

\newfontfamily\vtgn{Vortigenu}
\newcommand\VTGN[1]{{\vtgn #1}} % Note the double curly braces

This definition of \VTGN makes it unnecessary to execute \setmainfont twice. Moreover, it works without having to know what the main document font happens to be.

Related Question