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.

I have what's below and I do not know why the term m_{n+1,k} is not horizontally centered in its cell?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\begin{document}
\begin{tikzpicture}[baseline=(current  bounding  box.center)]
\tikzset{square matrix/.style={outer sep=-6pt,matrix of nodes,
nodes={draw,
minimum height=0.7cm,
anchor=center,
text width=0.7cm,
align=center,
outer sep=-6pt}}}
\matrix(mymatrix)[square matrix,left delimiter={[},right delimiter={]}]{
1 & 0\\
0 & $-m_{n+1,k}$\\};
\end{tikzpicture}
\end{document} 
share|improve this question
    
Because you specified text width, so the cell can't become large enough to accommodate the whole text. Try minimum width instead. Side question: Do you actually want the node borders to be drawn, or is this just for testing purposes? –  Jake Feb 9 '12 at 22:01
    
borders are here for testing purposes. I'll give the minimum width option a try. Thank you –  pluton Feb 10 '12 at 1:53
    
Just remove the text width=0.7cm and it will center automatically anyway or reduce the font size with \scriptscriptstyle. Otherwise you will be overprinting. –  percusse Feb 10 '12 at 15:29
add comment

1 Answer

up vote 2 down vote accepted

ok, the minimum width option helps but I am now using a \makebox[0pt][c]{$-m_{k+1,n}$} to get the desired matrix.

share|improve this answer
add comment

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.