TransWikia.com

cannot compile matrix to pdf

TeX - LaTeX Asked by Josephine Woon on June 10, 2021

I have a problem knitting my rmd to pdf. I have tried copying the code that works for others from this forum but it is not working for me. I keep receiving:

!LaTeX Error: Can be used only in preamble.
Can anyone please help?

title: "Untitled" output: pdf_document: latex_engine: xelatex

library("tinytex")

`

documentclass{article}
usepackage{mathtools}
usepackage{amsmath} 
begin{document}

[
begin{bmatrix}
    x_{11}       & x_{12} & x_{13} & dots & x_{1n} 
    x_{21}       & x_{22} & x_{23} & dots & x_{2n} 
    hdotsfor{5} 
    x_{d1}       & x_{d2} & x_{d3} & dots & x_{dn}
end{bmatrix}
=
begin{bmatrix}
    x_{11} & x_{12} & x_{13} & dots  & x_{1n} 
    x_{21} & x_{22} & x_{23} & dots  & x_{2n} 
    vdots & vdots & vdots & ddots & vdots 
    x_{d1} & x_{d2} & x_{d3} & dots  & x_{dn}
end{bmatrix}
]
end{document}

Thanks for replying to my issue. However, I still can’t sort out the problem myself. Hence I have attached the log file for your perusal.
Unt.log

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP