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'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}
share|improve this question
2  
! Undefined control sequence. l.5 \vecd and ! LaTeX Error: Environment bmatrix* undefined. Please correct your example –  David Carlisle Oct 23 '13 at 13:54
2  
It is compiling without errors here. I can't see the 'beyond delimiters' problem, though. Image –  Pedro Oct 23 '13 at 14:05
    
The error is fixed now. I apologize for it. –  DJJerome Oct 23 '13 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. –  Steven B. Segletes Oct 23 '13 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' Oct 23 '13 at 17:31

2 Answers 2

up vote 4 down vote accepted

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.

enter image description here

share|improve this answer

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}

enter image description here

share|improve this answer
    
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. –  DJJerome Oct 23 '13 at 16:31
    
@DJJerome See revised solution. –  Steven B. Segletes Oct 23 '13 at 17:17

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.