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.

\begin{tabular}[c]{| p{1.85cm} | p{1.85cm} | p{1.85cm} | p{1.85cm} | p{1.85cm} | p{1.85cm} | p{1.85cm} |}
     & \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

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{\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.

  • Can you please show a complete MWE? In this case, I would guess your problems are due in part to your custom macros, so seeing their definitions is necessary to solve the issue...
    – darthbith
    Commented Oct 22, 2014 at 18:37
  • The \VTGN{} command may have excess white space in it. See What is the use of percent signs (%) at the end of lines? for how you might fix that. TikZ may be the answer to your need to write texts at particular coordinates: see TeXample.net for ideas there. Commented Oct 22, 2014 at 18:41
  • 1
    I wouldn't use \centerline in latex, just use >{\centering\arraybackslash}p{..} You could use \begin{picture} to position text by coordinates but a tabular is usually easier Commented Oct 22, 2014 at 18:54
  • please make a self contained complete document that shows the problem, preferably using a standard font so we can run it locally Commented Oct 22, 2014 at 18:56
  • In this case, Mico's answer I think is more than enough. But in some cases, I have had problems with tables that only a PGF \matrixofnodes could solve.
    – jja
    Commented Oct 22, 2014 at 20:21

1 Answer 1


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

\usepackage[paperheight=28cm, paperwidth=20cm, margin=2cm]{geometry}
\newcommand\VTGN[1]{#1} %% just so that this example compiles
\setlength\tabcolsep{0.1pt} % default: 6pt
\begin{tabularx}{\textwidth}{ | *{7}{Y|} }
\bigstrut & addition & subtraction & multiplication & division & exponentiation & rootification \\ 
Vortigenu \bigstrut & \VTGN{+} & \VTGN{-} & \VTGN{*} & \VTGN{/} & \VTGN{\char"5E} & \VTGN{\char"40} \\ 
Earth \bigstrut & + & $-$ & $\times$ & $\div$ & ? & ? \\ 

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:

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

  • This is great and much cleaner. I was using tabluar and wasn't aware that tabularx existed. Is it just a modern version of tabular? Can u also explain what the newcolumntype Y and its innards does? I'm experimenting with it and the bigstrut, along with ways to scale the fontsize inside certain cells, which seems to be working except it incurs a slight vertical offset depending on how big a value i use in \scalefont{}
    – DrZ214
    Commented Oct 23, 2014 at 8:40
  • @user1705043 - The tabularx package is definitely well worth becoming familiar with. The main new column type of that package is called X. The virtue of the X column type is that LaTeX handles the tedious job of computing column widths. However, cells in an X column are set fully justified by default. Since you want to center-set the cells' contents, it's handy to create a new column type, which I've called Y, using the code provided in the answer. Not having access to the special Vortigenu font, I can't offer advice on the other issue you mention.
    – Mico
    Commented Oct 23, 2014 at 8:51
  • thanks this is working great, i even got the main cells' contents to double their font size without too much trouble. I also took ur advice and modified my \VTGN macro. Only thing I dont understand is why my original example made the cells tall just by using \centerline{}, which for some reason seems to add a blank line in each cell, making them thicker.
    – DrZ214
    Commented Oct 24, 2014 at 9:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .