I'm using LyX. I came across with the following Matrix:

enter image description here

I could use the following LaTeX for that:

\begin{bmatrix}| & |\\
\underline{x}_{1} & \underline{x}_{2}\\
| & |

But is it the right way? What If I want the | in multilines? Then I'll just use the | in each place. I'm sure there is a better way for that.

  • Do you just need to separate two columns like so? imgur.com/tYz9rTe
    – antshar
    Commented May 26, 2020 at 16:57
  • @antshar Thanks for the reply but not. That's easy. I would like to have | on the top and bottom and x_1 in the middle.
    – vesii
    Commented May 26, 2020 at 17:09
  • Something like that? imgur.com/pfYyIC8
    – antshar
    Commented May 26, 2020 at 17:10

1 Answer 1


I think that this question is a duplicate of this: How do I typeset vertical and horizontal lines inside a matrix?

Here I put a small code where I have changed the parameters of vertical rules.

enter image description here

\[\begin{bmatrix}\vertbar &\vertbar\\
\underline{x}_{1} & \underline{x}_{2}\\
\vertbar & \vertbar

You must log in to answer this question.

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