# How to Correct Entries in a Matrix Going Beyond Delimiters Using fouriernc

I'm using the bmatrix environment with fractional entries. My problem is that the fractions extend beyond the "edge" created by the brackets. I know there are other environments that could be used. How might one correct this? Also, I want my fractions written in the form below, not, for example, 1/2. Here is my code:

\documentclass{article}
\usepackage{amsmath, amssymb, mathtools, fouriernc}
\newcommand{\vecd}[1]{\mathbf{#1}}
\begin{document}
$\vecd{x}^{(k+1)} = \begin{bmatrix*}[r] 0 & \tfrac{1}{4} & -\tfrac{1}{4} \\[3pt] \tfrac{1}{3} & 0 & -\tfrac{1}{3} \\[3pt] -\tfrac{1}{5} & -\tfrac{1}{5} & 0 \end{bmatrix*} \vecd{x}^{(k)} + \begin{bmatrix*}[r] 4 \\ -1 \\ 1 \end{bmatrix*}$
\end{document}

• ! Undefined control sequence. l.5 \vecd and ! LaTeX Error: Environment bmatrix* undefined. Please correct your example Commented Oct 23, 2013 at 13:54
• It is compiling without errors here. I can't see the 'beyond delimiters' problem, though. Image Commented Oct 23, 2013 at 14:05
• The error is fixed now. I apologize for it. Commented Oct 23, 2013 at 15:01
• Readers, an edited question reveals the problem arises as an interaction with the fouriernc package. Perhaps Djjerome can edit his title or question to reflect that point. Commented Oct 23, 2013 at 17:22
• IMHO even the way how it looks is fine. In general, I don't see any need for delimiters to cover the whole thing they "delimit", be it a matrix, fraction, complicated exponent or whatever.
– yo'
Commented Oct 23, 2013 at 17:31

For fouriernc a lower value of \delimitershortfall than the default 5pt seems necessary:

\documentclass{article}
\usepackage{amsmath, amssymb, mathtools, fouriernc}
\newcommand{\vecd}[1]{\mathbf{#1}}

\delimitershortfall=3pt

\begin{document}
$\vecd{x}^{(k+1)} = \begin{bmatrix*}[r] 0 & \tfrac{1}{4} & -\tfrac{1}{4} \\[3pt] \tfrac{1}{3} & 0 & -\tfrac{1}{3} \\[3pt] -\tfrac{1}{5} & -\tfrac{1}{5} & 0 \end{bmatrix*} \vecd{x}^{(k)} + \begin{bmatrix*}[r] 4 \\ -1 \\ 1 \end{bmatrix*} + \begin{bmatrix*}[r] 4 \\ -1 \end{bmatrix*}$
\end{document}


I apologize for the nonsense math: I just wanted to show the effect.

As you note, the problem is a bad interaction with one of your packages. To manually overcome it, I define \mystrut which is a rule that sinks low enough and rises high enough so that adding it to a top row entry and to a bottom row entry, suitably grows the height of the brackets.

However, I also give this solution as an alternative approach, if you wish to control the vertical and horizontal spacing between matrix entries, which may be of use when displaying \textstyle fractions, as you do.

After giving your original solution, and the modified solution with the strut fix, I then give a solution that uses my under-construction tabstackengine.sty package, currently posted at Writing a table with equally spaced columns, based on the widest column

\documentclass{article}
\usepackage{amsmath, amssymb, mathtools, fouriernc}
\usepackage{tabstackengine}
\newcommand{\vecd}[1]{\mathbf{#1}}
\newcommand\mystrut{\rule[-1.5ex]{0ex}{4ex}}
\begin{document}
ORIGINAL
$\vecd{x}^{(k+1)} = \begin{bmatrix*}[r] 0 & \tfrac{1}{4} & -\tfrac{1}{4} \\[3pt] \tfrac{1}{3} & 0 & -\tfrac{1}{3} \\[3pt] -\tfrac{1}{5} & -\tfrac{1}{5} & 0 \end{bmatrix*} \vecd{x}^{(k)} + \begin{bmatrix*}[r] 4 \\ -1 \\ 1 \end{bmatrix*}$

MODIFIED ORIGINAL
$\vecd{x}^{(k+1)} = \begin{bmatrix*}[r] \mystrut0 & \tfrac{1}{4} & -\tfrac{1}{4} \\[3pt] \tfrac{1}{3} & 0 & -\tfrac{1}{3} \\[3pt] -\tfrac{1}{5} & -\tfrac{1}{5} & 0\mystrut \end{bmatrix*} \vecd{x}^{(k)} + \begin{bmatrix*}[r] 4 \\ -1 \\ 1 \end{bmatrix*}$

TABSTACKENGINE (1.8baselineskip vertical \& 1.8ex intercolumngap)
\setstackgap{L}{1.8\baselineskip}
\setstackTABgap{1.8ex}
$\mathbf{x}^{(k+1)} = \bracketMatrixstack[r]{ 0 & \frac{1}{4} & -\frac{1}{4}\\ \frac{1}{3} & 0 & -\frac{1}{3}\\ -\frac{1}{5} & -\frac{1}{5} & 0 } \mathbf{x}^{(k)} + \bracketVectorstack[r]{4\\-1\\1}$
\end{document}


• I see why you are not seeing the over-running the edge. It's because I neglected to include the fouriernc package. I've updated the original question. Commented Oct 23, 2013 at 16:31
• @DJJerome See revised solution. Commented Oct 23, 2013 at 17:17