행렬 요소 사이에 광선 그리기

행렬 요소 사이에 광선 그리기

다음과 같은 수학적 표현을 그려보고 싶습니다.

원하는 출력

환경 을 고려하여 많은 노력을 했지만 tabular원하는 결과를 얻지 못했습니다. 누군가 나를 도와줄 수 있나요?

또 다른 질문은 다음과 같은 방식으로 대각선을 그리는 방법입니다.

  1. 아래 행렬식에서엑스, 광선1에게c 2그리고로부터2에게c 1.
  2. 아래 행렬식에서와이, 광선c 1에게2그리고로부터c 2에게1.
  3. 1 아래의 행렬식에서,1에게2그리고로부터2에게1.

답변1

따라서 문서 클래스나 로드된 패키지를 알지 못한 채 이 (물론 추악한) 예제를 통해 질문의 첫 번째 부분을 해결할 수 있습니다.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
$\frac{x}{\begin{vmatrix}b_1&c_1\\ b_2&c_2 \end{vmatrix}}=\frac{y}{\begin{vmatrix} c_1&a_1 \\ c_2&a_2 \end{vmatrix}}=\frac{1}{\begin{vmatrix} a_1&b_1\\a_2&b_2 \end{vmatrix}}$

$\displaystyle\frac{x}{\begin{vmatrix}b_1&c_1\\ b_2&c_2 \end{vmatrix}}=\frac{y}{\begin{vmatrix} c_1&a_1 \\ c_2&a_2 \end{vmatrix}}=\frac{1}{\begin{vmatrix} a_1&b_1\\a_2&b_2 \end{vmatrix}}$
\end{document}

둘의 차이는 \displaystyle마음에 들 수도 있고, 마음에 들지 않을 수도 있습니다.

답변2

표 3.6에서Latex 버전 5.04에 대한 짧지 않은 소개\nearrow, 두 개의 기호 및 를 찾을 수 있습니다 \searrow. 행렬식에 더미 열과 더미 행(둘 다 가운데에 있음)을 추가하고 이 두 기호를 가운데 셀에 넣을 수 있습니다. 겹치게 하기 위해 음수 간격을 사용했습니다.이것은 우아한 해결책이 아닙니다., 그러나 amsmath 이외의 추가 패키지는 필요하지 않습니다. 나는 또한 다음을 기반으로 너무 우아하지 않은 또 다른 솔루션을 가지고 있습니다 raisebox.https://en.wikibooks.org/wiki/LaTeX/Boxes#raisebox

\documentclass[12pt,a5paper]{article}
\usepackage{amsmath}
\begin{document}
a\\
\(
\begin{vmatrix}
b_1 & & c_1\\
& \nearrow \hspace{-1em} \searrow &\\
b_2 & & c_2\\
\end{vmatrix}
\)
\\
%another solution
\(
\begin{vmatrix}
b_1 & & c_1\\
b_2 & & c_2\\
\end{vmatrix}
\)
\hspace{-3.2em} \raisebox{-0.3ex}\text{{$\nearrow$}}
\hspace{-1.7em} \raisebox{-0.3ex}\text{{$\searrow$}} 
\end{document}

여기에 이미지 설명을 입력하세요

답변3

사용자 jfbu의 코드를 복사하여 붙여넣었습니다.답변에게행렬 요소 사이에 광선 그리기. 꽤 입이 많지만 큰 그래픽 엔진을 피합니다. 매번 두 개의 편집이 필요했습니다. 와 일하다 pdflatex.

\documentclass{article}

% from https://tex.stackexchange.com/a/277474/4686 (user jfbu)
% --------------------------------START--------------------------------
% matrices
\usepackage{amsmath}

% I discovered a bad interaction of eso-pic with xetex
% which is fixed for an unknown reason to me by loading
% package geometry
\usepackage{geometry}

% transforms the page into a LaTeX picture
\usepackage{eso-pic}

% enhances original LaTeX picture
% there are other packages
% unfortunately I don't know how to draw dashed lines with pict2e
\usepackage{pict2e}

% for some color
\usepackage{color}

\makeatletter
\newbox\JayBox
\def\JayNodeCount{0}%

\def\zapspaces #1 #2{#1#2\zapspaces }

\newcommand\Node [2]{%
% make the code work also if no amsmath
    \ifcsname ifmeasuring@\endcsname
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi
    {\unless\ifmeasuring@}\iftrue
      \xdef\JayNodeCount{\the\numexpr\JayNodeCount+\@ne}%
      \ifcsname JAY@nodecoords@\romannumeral\JayNodeCount\endcsname
        \global
        \expandafter\let
        \csname JAY@nodename@\expandafter\zapspaces\detokenize{#1} \@gobble
        \expandafter\endcsname
        \csname JAY@nodecoords@\romannumeral\JayNodeCount\endcsname
      \else\typeout{========> New JAY node: run LaTeX again ! <========}%
      \fi
         \sbox\JayBox{$\m@th #2$}%
      \pdfsavepos
         \edef\JAY@temp{%
              \global
              \def\@backslashchar
                          JAY@nodecoords@\romannumeral\JayNodeCount
                  {{\noexpand\the\numexpr\pdflastxpos+\number\wd\JayBox/2}%
                   {\noexpand\the\numexpr\pdflastypos+\number\ht\JayBox/2}%
                   {\number\wd\JayBox/2}{\number\ht\JayBox/2}}%
                       }%
         \write\@mainaux\expandafter{\JAY@temp}%
    \fi
    #2%
}%

\def\JAY@north{north}
\def\JAY@south{south}
\def\JAY@west {west}
\def\JAY@east {east}
\def\JAY@northwest{northwest}
\def\JAY@northeast{northeast}
\def\JAY@southeast{southeast}
\def\JAY@southwest{southwest}


\def\JAY@setupAnode #1#2#3#4%
{%
    \def\JAY@Ax {#1}\def\JAY@Ay {#2}\def\JAY@Adx {#3}\def\JAY@Ady {#4}%
    \ifx\JAY@Aspec\JAY@north\edef\JAY@Ay {\the\numexpr\JAY@Ay+\JAY@Ady}\fi
    \ifx\JAY@Aspec\JAY@south\edef\JAY@Ay {\the\numexpr\JAY@Ay-\JAY@Ady}\fi
    \ifx\JAY@Aspec\JAY@west \edef\JAY@Ax {\the\numexpr\JAY@Ax-\JAY@Adx}\fi
    \ifx\JAY@Aspec\JAY@east \edef\JAY@Ax {\the\numexpr\JAY@Ax+\JAY@Adx}\fi
    \ifx\JAY@Aspec\JAY@northwest
                   \edef\JAY@Ay {\the\numexpr\JAY@Ay+\JAY@Ady}%
                   \edef\JAY@Ax {\the\numexpr\JAY@Ax-\JAY@Adx}%
    \fi
    \ifx\JAY@Aspec\JAY@northeast
                   \edef\JAY@Ay {\the\numexpr\JAY@Ay+\JAY@Ady}%
                   \edef\JAY@Ax {\the\numexpr\JAY@Ax+\JAY@Adx}%
    \fi
    \ifx\JAY@Aspec\JAY@southeast
                   \edef\JAY@Ay {\the\numexpr\JAY@Ay-\JAY@Ady}%
                   \edef\JAY@Ax {\the\numexpr\JAY@Ax+\JAY@Adx}%
    \fi
    \ifx\JAY@Aspec\JAY@southwest
                   \edef\JAY@Ay {\the\numexpr\JAY@Ay-\JAY@Ady}%
                   \edef\JAY@Ax {\the\numexpr\JAY@Ax-\JAY@Adx}%
    \fi
}%

\def\JAY@setupBnode #1#2#3#4%
{%
    \def\JAY@Bx {#1}\def\JAY@By {#2}\def\JAY@Bdx {#3}\def\JAY@Bdy {#4}%
    \ifx\JAY@Bspec\JAY@north\edef\JAY@By {\the\numexpr\JAY@By+\JAY@Bdy}\fi
    \ifx\JAY@Bspec\JAY@south\edef\JAY@By {\the\numexpr\JAY@By-\JAY@Bdy}\fi
    \ifx\JAY@Bspec\JAY@west \edef\JAY@Bx {\the\numexpr\JAY@Bx-\JAY@Bdx}\fi
    \ifx\JAY@Bspec\JAY@east \edef\JAY@Bx {\the\numexpr\JAY@Bx+\JAY@Bdx}\fi
    \ifx\JAY@Bspec\JAY@northwest
                   \edef\JAY@By {\the\numexpr\JAY@By+\JAY@Bdy}%
                   \edef\JAY@Bx {\the\numexpr\JAY@Bx-\JAY@Bdx}%
    \fi
    \ifx\JAY@Bspec\JAY@northeast
                   \edef\JAY@By {\the\numexpr\JAY@By+\JAY@Bdy}%
                   \edef\JAY@Bx {\the\numexpr\JAY@Bx+\JAY@Bdx}%
    \fi
    \ifx\JAY@Bspec\JAY@southeast
                   \edef\JAY@By {\the\numexpr\JAY@By-\JAY@Bdy}%
                   \edef\JAY@Bx {\the\numexpr\JAY@Bx+\JAY@Bdx}%
    \fi
    \ifx\JAY@Bspec\JAY@southwest
                   \edef\JAY@By {\the\numexpr\JAY@By-\JAY@Bdy}%
                   \edef\JAY@Bx {\the\numexpr\JAY@Bx-\JAY@Bdx}%
    \fi
}%

\newcommand\NodeLine [2][]{\def\JAY@opt{#1}\JAY@NodeLine #2\JAY@NodeLine}

\def\JAY@NodeLine #1[#2]#3->#4[#5]#6\JAY@NodeLine
{%
    \edef\JAY@nodeA {\expandafter\zapspaces\detokenize{#1} \@gobble}%
    \edef\JAY@nodeB {\expandafter\zapspaces\detokenize{#4} \@gobble}%
    \let\JAY@temp\empty
    \ifcsname JAY@nodename@\JAY@nodeA\endcsname
    \ifcsname JAY@nodename@\JAY@nodeB\endcsname
       \edef\JAY@Aspec {\zapspaces #2 \@gobble}%
       \edef\JAY@Bspec {\zapspaces #5 \@gobble}%
       \expandafter\expandafter\expandafter
            \JAY@setupAnode\csname JAY@nodename@\JAY@nodeA\endcsname
       \expandafter\expandafter\expandafter
            \JAY@setupBnode\csname JAY@nodename@\JAY@nodeB\endcsname
    \edef\JAY@temp {%
     \noexpand\AddToShipoutPictureFG*{%
% THIS IS THE ONLY PLACE WHERE THE PICTURE SYNTAX IS USED
% here we use \Line from package pict2e
% The optional argument to \NodeLine contains optional commands
       {\setlength{\unitlength}{1sp}%
       \linethickness{1pt}%
       \unexpanded\expandafter{\JAY@opt}%
       \noexpand\Line (\JAY@Ax,\JAY@Ay)(\JAY@Bx,\JAY@By)%
                   }}}%
    \fi\fi
  \JAY@temp
}
\makeatother
% --------------------------------FINISH-------------------------------

\begin{document}

\Huge

\[\frac{x}
  {\begin{vmatrix}\Node{B1}{b_1}&\Node{C1}{c_1}\\
    \Node{B2}{b_2}&\Node{C2}{c_2}\end{vmatrix}}
=
  \frac{y}
  {\begin{vmatrix} 
    \Node{C1y}{c_1}&\Node{A1y}{a_1} \\
    \Node{C2y}{c_2}&\Node{A2y}{a_2} \end{vmatrix}}
=
   \frac{1}
    {\begin{vmatrix}
    a_1&b_1\\a_2&b_2 \end{vmatrix}}
\]
% No need to be inside the display, but
% make sure to issue these commands on the same page !

% TWO COMPILATIONS NEEDED AFTER ANY MODIFICATION

\NodeLine[\color{blue}]{B1[south east] -> C2[north west]}
\NodeLine[\color{red}] {C1[south west]-> B2[north east]}
% for some reason B2[east] gives more pleasing result than B2[north east]
% note that B2 alone does not work, must be B2[]

\NodeLine[\color{green}]{C1y[] -> A2y[]}
\NodeLine[\color{magenta}] {A1y[]-> C2y[]}

\end{document}

인용구

관련 정보