gpt4 book ai didi

pdf - 如何 : Markdown PDF align table to the left

转载 作者:行者123 更新时间:2023-12-04 13:59:58 25 4
gpt4 key购买 nike

目标
我一直想创建一个 pdf 报告功能,但我无法按照我的意愿重新设计 pdf 的布局。我要解决的问题之一是我无法将表格向左对齐。现在它在中间居中。

系统及其他

  • CentOS 6.9 版(最终版)
  • TeX 3.141592 (Web2C 7.5.6)

  • 模板.Rmd
    ---
    title: "Reporting"
    output: pdf_document
    ---

    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = TRUE)
    ```
    ```{r, results='asis', echo=FALSE}
    knitr::kable(head(cars), format = "markdown") %>%
    kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
    ```

    build_report.R
    # Libraries
    require(knitr)
    require(markdown)
    library(RMySQL)
    library(png)
    library(kableExtra)

    # create .md file
    knit("template.Rmd", "template.md")

    # create .html file
    markdownToHTML("template.md", "template.html", options=c("use_xhml"))

    # create .pdf file
    command <- paste0("pandoc -V geometry:'left=0.5in,bottom=1in,top=1.5in' -s ", "template.html", " -o ", "output.pdf")
    system(command)

    输出.pdf
    输出示例(忽略不相关信息) 1

    最佳答案

    删除 format = "markdown"kable并放 library(kableExtra)某处

    关于pdf - 如何 : Markdown PDF align table to the left,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51259270/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com