6

Now... I know this code is embarrassing but it's the closer I've got, at least as displayed output, to what I'm trying to do

\documentclass{article}
\usepackage{amsmath,blkarray,newpxtext,newpxmath}
\begin{document}
\[
\begin{aligned}
 j\qquad\qquad\:\:\;\, \\
 i\,\left(
\begin{blockarray}{lrlr}
\begin{block}{lr|lr}
 a_{11} & \dots & \dots & a_{1n} \\
\vdots & \quad & \quad & \vdots \\
\end{block}
\hline
\begin{block}{lr|lr}
\vdots & \quad & \quad & \vdots \\
 a_{n1} & \dots & \dots & a_{nn} \\
\end{block}
\end{blockarray}
\right) \\
\end{aligned}
\]
\end{document}

The output is the following:

What I'm trying to do is basically what you see in the image above, but with a "a_{ij}" element in the middle instead of the cross. Also the alignment of i and j is made using spaces, which I suppose is not the best solution.

Any suggestions?

Thanks in advance.

6

Adding this as an additional answer. You could use the multirow package with this code:

\documentclass{article}
\usepackage{amsmath,newpxtext,newpxmath,multirow}
\begin{document}
\[
i\ \overset{\textstyle{j}}{\left(\begin{array}{ccccc}
a_{11} & \cdots & \multirow{2}{*}{\rule[-4ex]{.5pt}{5.5ex}} & \cdots & a_{1n}\\
\vdots &  &  &  & \vdots\\
\multicolumn{2}{c}{\rule[.5 ex]{9ex}{.5pt}} & a_{ij} & \multicolumn{2}{c}{\rule[.5 ex]{9ex}{.5pt}} \\
\vdots &  & \multirow{2}{*}{\rule[-2ex]{.5pt}{5ex}} &  & \vdots\\
a_{n1} & \cdots &  & \cdots & a_{nn}
\end{array}\right)}
\]
\end{document}

Here's the output:

enter image description here

| improve this answer | |
4

Is this what you have in mind?

\[
i\overset{\textstyle{j}}{\begin{pmatrix}
a_{11} & \cdots &  & \cdots & a_{1n}\\
\vdots &  & \vdots &  & \vdots\\
 & \cdots & a_{ij} & \cdots & \\
\vdots &  & \vdots &  & \vdots\\
a_{n1} & \cdots &  & \cdots & a_{nn}
\end{pmatrix}}
\]

enter image description here

You could remove the additional \vdots and \cdots commands if you like. Or add some \ddots for diagonals.

| improve this answer | |
  • This solves the i and j alignment problem, but I also need the straight lines instead of dots. Sorry if I didn't made myself clear, and thanks for your help – CAKES Sep 26 '17 at 17:08
  • I provided an additional answer with the lines. – Sandy G Sep 26 '17 at 20:04
3

Here is a simple solution with booktabs, a pmatrix environment and one more column:

\documentclass{article}
\usepackage{mathtools, blkarray, newpxtext, newpxmath}
\usepackage{booktabs}

\begin{document}

\[ \begin{aligned}
    \MoveEqLeft[4.6]\scriptstyle j \\[-0.5ex]
    \raisebox{0.4ex}{$\scriptstyle i $~}\begin{pmatrix}
      \!\!\begin{blockarray}{lr@{}c@{}lr}
        \begin{block}{c@{\enspace}c@{}c@{}c@{\enspace}c}
          a_{11} & ... & \vrule & ... & a_{1n} \\
            ⋮ & \quad &\vrule & \quad & ⋮ \\
        \end{block}
        & & a_{ij} & & \\[-1.5ex]
        \cmidrule[0.4pt](l){1-2}\cmidrule[0.4pt](r){4-5}\addlinespace[0.6ex]
        \begin{block}{c@{\enspace}c@{}c@{}c@{\enspace}c}
            ⋮ & \quad & \vrule & \quad & ⋮ \\
          a_{n1} & ... & \vrule & ... & a_{nn}\\[-1.6ex]
        \end{block}
      \end{blockarray}\!\!
      %\right) \\
    \end{pmatrix}
  \end{aligned} \]

\end{document} 

enter image description here

| improve this answer | |
  • Ok, now this is exactly what I want! Although I'm having some problems with the newpxpackage (which I've just installed), when I compile it gives me ! LaTeX Error: File 'binhex.tex' not found. <\br> Any idea what is the problem here and how to solve? – CAKES Sep 26 '17 at 17:46
  • @CAKES - Which TeX distribution (and which vintage) is installed on your system? – Mico Sep 26 '17 at 18:26
  • @Mico - I'm using MacTeX and... what's a vintage? (Sorry if I'm such a newbie) – CAKES Sep 26 '17 at 18:42
  • 1
    Mico means ‘which year?’. – Bernard Sep 26 '17 at 18:45
  • @CAKES - Is it MacTeX2017, MacTeX2016, MacTeX2009, etc? Did you do a full or just a "minimal" installation of MacTeX? – Mico Sep 26 '17 at 18:45
1

You can do it with blkarray; the only needed tricks are \BAmulticolumn and a definition for a filling rule higher than \hrulefill.

I defined the height the same as the fraction bar.

\documentclass{article}
\usepackage{amsmath,blkarray,newpxtext,newpxmath}

\newcommand{\highhrulefill}{%
  \leavevmode
  \leaders\hrule height \dimexpr\fontdimen22\textfont2+0.2pt\relax
                 depth  \dimexpr-\fontdimen22\textfont2+0.2pt\relax
  \hfill
  \kern 0pt
}

\begin{document}
\[
\begin{blockarray}{ccc|cc}
&& \BAmulticolumn{2}{c}{j} \\
\begin{block}{c(cc|cc)}
& a_{11} & \cdots & \cdots & a_{1n} \\
& \vdots &       &       & \vdots \\
i & \BAmulticolumn{4}{c}{\highhrulefill \; a_{ij} \; \highhrulefill} \\
& \vdots &       &       & \vdots \\
& a_{n1} & \cdots & \cdots & a_{nn} \\
\end{block}
\end{blockarray}
\]
\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.