TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to TeX a transition matrix for a Markov process and I want to be consistent with our textbook and label the columns and rows. I found \kbordermatrix and that let me produce:

                    &L&M&C  \cr
            L& .94 &  .02  & .01    \cr
            M& .05  &  .96 &  .04   \cr
            C& .01 & .02 & .95      \cr

But I'd like to add another label that spans the last three columns that says Current State (and is underline) and I'd like a way to label the the last three rows with Next State.

Is there an easy way to do this?

share|improve this question
Welcome to TeX.sx! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. An image of the desired output would be a great help. – masu Nov 22 '13 at 19:01

It's quite an ugly solution, but it's the closest I can get:


    & \mbox{\hspace{6mm}Current State} \\ 

    \parbox[c][17mm][t]{3mm}{\rotatebox{90}{Next State}} &
    $ \kbordermatrix{
      & L   & M   & C   \cr
    L & .94 & .02 & .01 \cr
    M & .05 & .96 & .04 \cr
    C & .01 & .02 & .95 \cr
    } $ \\ 


This results in:

enter image description here

The 6mm is used to position the 'Current State'

The 17mm is used to position the 'Next State'

The 3mm is the space between 'Next State' and the matrix

share|improve this answer

Your Answer


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.