4

I'd like to produce a bunch of pages in the 'minicard' format (2.75 by 1.1), with a 1-inch qr code taking up one side of the thing, and centered multiline text on the other side.

Unfortunately, I don't have a handle on vertical centering. My current approach uses the 'm' column type, which supposedly centers text vertically, but that isn't happening:

\documentclass{article}

\usepackage{graphicx}
\usepackage{array}
\usepackage[margin=.05in,papersize={2.75in,1.1in}]{geometry}
\begin{document}

\renewcommand\arraystretch{0}
\renewcommand\tabcolsep{0pt}

\begin{table}
\begin{tabular}{p{1in} | >{\centering\arraybackslash}m{1.65in} |}
\hline
\includegraphics[width=1in,height=1in]{600px-QR_code_Wikimedia_Commons_(URL).png} 
& unique key a 
\\ \hline
\end{tabular}
\end{table}

\end{document}

A solution would be wonderful, but I'd settle for an explanation. Should I even be using a table?

  • first post :) I wasn't able to insert a pair of images, but they seemed necessary to get my point across, so they've been code'd out. – zpmorgan Aug 26 '12 at 09:52
  • 1
    Welcome to TeX.sx! You need some more rep before able to include images so that they show automatically (I suspect this is a spam countering measure). I've included the images so that they show up in the post for you :-) – morbusg Aug 26 '12 at 09:57
  • Put your image inside this macro \raisebox{-1cm}{\includegraphics[.... } which might give you an idea why this is happening :) – percusse Aug 26 '12 at 09:58

1 Answers1

2

This is a known bug in the package, as described here: Vertical alignment in table: m-column, row size - problem in last column

You can use the tweak in your case too. You ought to increase the dimesions a bit to get rid of the warnings and to get everything settled correctly:

\documentclass{article}

\usepackage[demo]{graphicx} % remove `[demo]` in your case
\usepackage{array}
\usepackage[margin=.05in,papersize={2.79in,1.12in}]{geometry}
\begin{document}

\renewcommand\arraystretch{0}
\renewcommand\tabcolsep{0pt}

\begin{table}
\begin{tabular}{m{1.02in} | >{\centering\arraybackslash}m{1.65in} |@{}m{0pt}@{}}
\hline
\includegraphics[width=1in,height=1in]{600px-QR_code_Wikimedia_Commons_(URL).png} 
& unique key a 
&\\ \hline
\end{tabular}
\end{table}

\end{document}
yo'
  • 51,322