Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My sense is that I am missing something basic, but here goes:

I have a \tabular object, and on the same line as it ends, I wish to put a \Box

If I create a dummy column to store the \Box then the table is not wide enough (I want the box at the end of the line)

If I use \hfill $\Box$ after the end of the table (if there is a manual newline after the table, else it vertically centers it on the right which is also not what I want) it left justifies as it is the only thing on the line. If I use test \hfill $\Box$ I get what I want (well, its really one line down too far, but thats OK) but with a pesky test at the beginning of the line (as an aside, this seems to be a common issue with me, so if there is a way to have a "dummy" (not visible, has no other impact on the document) character that would do as well).

How can I get what I am looking for?

share|improve this question
    
The "dummy" object that you are looking for can be \mbox{} or \null. –  Gonzalo Medina Sep 6 '12 at 3:51
    
@GonzaloMedina this works and I will accept it, but I would prefer a cleaner way (and on the same line as the end of the table) –  soandos Sep 6 '12 at 3:58
    
I was not proposing using \mbox{} or \null as part of the solution; I was only mentioning that this is the standard "dummy" object you were asking for. –  Gonzalo Medina Sep 6 '12 at 4:05

1 Answer 1

up vote 4 down vote accepted

Use the [b] optional argument for tabular:

\documentclass{article}
\usepackage{amssymb}

\begin{document}

\begin{tabular}[b]{|cc|}
text & text \\
text & text \\
text & text \\
\end{tabular}\hfill$\Box$

\end{document}

enter image description here

Using [t], the top line of the table is aligned with the baseline of the current external line of text; using [b], the bottom line of the table is aligned with the external baseline; with [c] (or with no positioning argument given), the table is centered on the external baseline.

share|improve this answer
    
For some reason it come it comes out vertically centered on my table (snag.gy/8VBNP.jpg for an example of what it looks like on my table) –  soandos Sep 6 '12 at 3:53
    
@soandos Did you use the [b] alignment specifier I used in my example for tabular? –  Gonzalo Medina Sep 6 '12 at 3:54
    
Worked perfectly, thanks. What does it do? –  soandos Sep 6 '12 at 3:59
    
@soandos [b] vertically aligns the table at the bottom, [t] aligns it at the top and [c] (default) at the center. –  Gonzalo Medina Sep 6 '12 at 4:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.