LaTeX forum ⇒ Math & ScienceCustom matrix border Topic is solved

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
JoelSjogren
Posts: 3
Joined: Tue Jul 22, 2014 9:43 pm

Custom matrix border

Postby JoelSjogren » Tue Jul 22, 2014 10:14 pm

Hi, I want to create a matrix with a custom border. I'm pretty new to latex. This is what I have in mind: <polynum.png>.

I found a reference http://www.tex.ac.uk/ctan/info/math/vos ... thmode.pdf, in which section 5 discusses how to use \bordermatrix to get [ ] or { } instead of the regular ( ) border. Maybe the implementation given there could be used as a starting point; however it looks very complicated to me. Before I start trying to understand that wall of commands, I want to hear someone's comment on this whole matter.

Also I found these symbols: \urcorner, \llcorner.
Attachments
polynum.png
polynum.png (1.03 KiB) Viewed 4523 times

Tags:

esdd
Posts: 36
Joined: Sat Jan 25, 2014 9:13 pm

Postby esdd » Wed Jul 23, 2014 10:58 am

Here is a suggestion using tikz

  1. \documentclass{article}
  2. \usepackage{amsmath}
  3.  
  4. \usepackage{tikz}
  5. \newcommand\mborder[2][]{%
  6. \tikz[anchor=base,baseline]{
  7. \node[inner sep=1pt,#1](h){$\displaystyle#2\mathstrut$};
  8. \draw([xshift=.25em]h.south west)--(h.south west)--(h.north west)
  9. --(h.north east)--([yshift=-.25em]h.north east);
  10. }%
  11. }
  12.  
  13. \begin{document}
  14. \begin{align*}
  15. A & = \mborder{\begin{matrix}x_1 &x_2\\ y_1&y_2\end{matrix}}
  16. \end{align*}
  17. \end{document}


matrixborder.png
matrixborder.png (3.06 KiB) Viewed 4511 times


Best regards
Elke

JoelSjogren
Posts: 3
Joined: Tue Jul 22, 2014 9:43 pm

Postby JoelSjogren » Wed Jul 23, 2014 11:17 am

It looks great!

User avatar
Stefan Kottwitz
Site Admin
Posts: 9597
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Wed Jul 23, 2014 10:05 pm

Hi JoelSjogren,

welcome to the forum!

Yes, Elke is a TikZ wizard, I often see her TikZ magic where basic LaTeX is not enough. :-)
TikZ is a package with really a lot of capabilities, but don't hesitate to use it also for such small things.

Stefan
LaTeX.org admin

JoelSjogren
Posts: 3
Joined: Tue Jul 22, 2014 9:43 pm

Postby JoelSjogren » Sat Jul 26, 2014 2:38 pm

I'll look into that package some more. I heard of it before when I needed to draw intervals and it seems useful :)


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 2 guests