我在将数据帧转换为 pdf 文件时遇到困难。我尝试先转换为 Latex,然后转换为 pdf,但问题是我使用 Latexify 包将数据帧转换为 Latex 格式,但 Latexify() 函数的输出不正确,因为当转换为 pdf 时,它会给出扭曲的表格。那么,你能帮我一下吗?这是示例代码
\nusing DataFrames\nusing PrettyTables\nusing LaTeXStrings\nusing Latexify\n# Create a DataFrame\ndf = DataFrame(A = [1, 2, 3], B = [4, 5, 6], C = [7, 8, 9])\n# Convert the DataFrame to a LaTeX table\nlatex_table = latexify(df,latex=false)\n# Print the LaTeX table\nprintln(latex_table)\n# Define the LaTeX document as a string\nlatex_doc = \xe2\x80\x9c\xe2\x80\x9d"\n\\\\documentclass{article}\n\\\\usepackage{booktabs}\n\\\\begin{document}\n$latex_table\n\\\\end{document}\n\xe2\x80\x9c\xe2\x80\x9d"\n# Save the LaTeX document to a file\nwrite(\xe2\x80\x9cmydoc.tex\xe2\x80\x9d, latex_doc)\n# Define the name of the LaTeX file\nlatex_file = \xe2\x80\x9cmydoc.tex\xe2\x80\x9d\n# Run the pdflatex …Run Code Online (Sandbox Code Playgroud)