Skip to content

Instantly share code, notes, and snippets.

@zr-tex8r
Created November 29, 2015 04:24
Show Gist options
  • Save zr-tex8r/25987f8958841004a90a to your computer and use it in GitHub Desktop.
Save zr-tex8r/25987f8958841004a90a to your computer and use it in GitHub Desktop.
LaTeX: complicated matrix description
\documentclass[uplatex,dvipdfmx,9pt,a5paper,papersize,fleqn]{jsarticle}
\usepackage{tikz,varwidth}
\usetikzlibrary{matrix,decorations.markings}
\begin{document}
\begin{equation}
\makebox[0pt][r]{\makebox[\mathindent][l]{1)}}
P_n(i,j) = \left(\begin{varwidth}[c]{\linewidth}%
\newcommand{\X}{\phantom{0}}%
\begin{tikzpicture}[
mleader/.style={decorate, decoration={markings,
mark=between positions 0 and 1 step 0.5em with
{ \node {.}; }}},
tips/.style={font=\footnotesize,align=center}]
\matrix[matrix of math nodes, nodes in empty cells,
column sep=0pt, row sep=-2pt] (M) {
1 & & &\X & & & &\X & & & \\
&\ddots&& & & & & & & & \\
& & 1 & & & & & & & & \\
\X & & & 0 & & & & 1 & & &\X \\
& & & & 1 & & & & & & \\
& & & & &\ddots&& & & & \\
& & & & & & 1 & & & & \\
\X & & & 1 & & & & 0 & & &\X \\
& & & & & & & & 1 & & \\
& & & & & & & & &\ddots&\\
& & &\X & & & &\X & & & 1 \\
};
\useasboundingbox (M);
\draw[mleader](M-4-1.west) node[left=1.2em,tips]{第$i$行→}
--(M-4-4)--(M-4-8)--(M-4-11.east);
\draw[mleader](M-8-1.west) node[left=1.2em,tips]{第$j$行→}
--(M-8-4)--(M-8-8)--(M-8-11.east);
\draw[mleader](M-1-4.north) node[above=0.2em,tips]{第$i$列\\↓}
--(M-4-4)--(M-8-4)--(M-11-4.south);
\draw[mleader](M-1-8.north) node[above=0.2em,tips]{第$j$列\\↓}
--(M-4-8)--(M-8-8)--(M-11-8.south);
\end{tikzpicture}%
\end{varwidth}\right),
\qquad i \neq j.
\end{equation}
すなわち,$n$次正方行列の,第$i$行と第$j$行とを交換したものが……
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment