添加水平和垂直线,矩阵

添加水平和垂直线,矩阵
A= [0.7577    0.7060    0.8235    0.4387    0.4898
        0.7431    0.0318    0.6948    0.3816    0.4456
        0.3922    0.2769    0.3171    0.7655    0.6463
        0.6555    0.0462    0.9502    0.7952    0.7094
        0.1712    0.0971    0.0344    0.1869    0.7547]
    latex_table = latex(sym(A));
    I save it as eqA.
    equations1.tex
        \newcommand{\eqA}{
                \left(
                        \begin{array}{ccccc}
                      \frac{6825116339432507}{9007199254740992} & 
                      \frac{6359497797823013}{9007199254740992} & 
                      \frac{3708524368810113}{4503599627370496} & 
                      \frac{987964467329731}{2251799813685248} & 
                      \frac{4411405500742427}{9007199254740992}\\ 
                      \frac{6693542213068579}{9007199254740992} & 
                      \frac{71681197541747}{2251799813685248} & 
                      \frac{6258459855040489}{9007199254740992} & 
                      \frac{859193262592067}{2251799813685248} & 
                      \frac{1003370923741521}{2251799813685248}\\ 
                      \frac{55201045594335}{140737488355328} & 
                      \frac{2494300503760379}{9007199254740992} & 
                      \frac{2856178200482939}{9007199254740992} & 
                      \frac{1723790560926853}{2251799813685248} & 
                      \frac{2910735031501795}{4503599627370496}\\ 
                      \frac{2952009981953243}{4503599627370496} & 
                      \frac{415874915283285}{9007199254740992} & 
                      \frac{8558839330135289}{9007199254740992} & 
                      \frac{3581261978445933}{4503599627370496} & 
                      \frac{6389390375844301}{9007199254740992}\\ 
                      \frac{770956303438939}{4503599627370496} & 
                      \frac{874885307559191}{9007199254740992} & 
                      \frac{77565677658637}{2251799813685248} & 
                      \frac{1683198784473707}{9007199254740992} & 
                      \frac{6797613319514473}{9007199254740992}
                  \end{array}
                          \right)
        }

    //latex
    \documentclass{article}
    \input{equations1}

    \begin{document}
        Here we have a nice matrix:
        \[
            \eqA{}
        \]

    \end{document}

如何添加水平线和垂直线以及标签表格的列和行。每次输入 eqA 时,表格内容都会更新。请参见图片在此处输入图片描述

答案1

您可以\hline在行之间使用来获取水平线,并|在数组前导中指定垂直线。由于(再次)您没有发布可以在本地运行的示例,因此我没有显示添加这些的结果。

\begin{array}{|c|c|}
\hline
a&b\\
\hline
x&y\\
\hline
\end{array}

是一个具有水平和垂直规则的 2x2 示例。

答案2

我使用了 mathworks.de/matlabcentral/fileexchange/4894-matrix2latex,效果很好。

相关内容