LaTeX学习笔记

LaTeX学习笔记

资料

  1. [LaTeX 公式] 数学模式里的拉丁字母表

问题

  1. BibLaTeX本地编译Empty Bibliography Citation Undefined错误的解决方法

    1
    2
    \usepackage[backend=bibtex]{biblatex}
    %xe->bibtex->xe->xe
  2. 优雅的导入svg (不知道svg2tikz行不行)
    How to include an SVG image in LATEX

    但是这个教程不适用于最新的inkscape

    https://inkscape.org/doc/inkscape-man.html

    • 下载inkscape
    • 将inkscape放入系统PATH中
    • 用法如下 注意 最后svg内文本框不要有回车!
    1
    2
    3
    4
    5
    #1
    function svg2pdf ($svg) {inkscape -D --export-latex --export-filename=$svg.pdf $svg.svg }
    svg2pdf a.svg
    #2
    inkscape -D --export-filename=a.pdf a.svg --export-latex

    最后在latex文档引用

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    %% To include the image in your LaTeX document, write
    \input{<filename>.pdf_tex}
    %% instead of
    \includegraphics{<filename>.pdf}
    %% To scale the image, write
    \def\svgwidth{<desired width>}
    \input{<filename>.pdf_tex}
    %% instead of
    \includegraphics[width=<desired width>]{<filename>.pdf}
    %%
    %% Images with a different path to the parent latex file can
    %% be accessed with the `import' package (which may need to be
    %% installed) using
    \usepackage{import}
    %% in the preamble, and then including the image with
    \import{<path to file>}{<filename>.pdf_tex}
    %% Alternatively, one can specify
    \graphicspath{{<path to file>/}}

    其他函数(自用)

    1
    2
    3
    function svg2pdf ($svg) {inkscape -D --export-latex --export-filename=./images/$svg.pdf ./images/$svg.svg }
    function svg2jpg ($svg) {inkscape -D --export-filename=./images/$svg.jpg ./images/$svg.svg }
    function svg2png ($svg) {inkscape -D --export-filename=./images/$svg.png ./images/$svg.svg }
  3. draw.io导入latex不能正常显示

    Embed diagrams in WordPress as SVG

    Why text in exported SVG images may not display correctly

  4. 将图表从draw.io导入LaTeX

    1
    2
    draw.io.exe -x "输入目录" -o "输出目录" -e --crop 
    #draw.io.exe -x --transparent ".\绘图\Desktop\" -o ".\images\" -e --crop
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    FILES := $(wildcard *.drawio)
    PDFS := $(addsuffix .pdf, $(FILES))

    .PHONY : all
    all : $(PDFS)

    %.drawio.pdf : %.drawio
    drawio $< --crop -x pdf -o $@

    clean :
    rm *.drawio.pdf
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    #!/bin/bash

    echo ------------------------- Converting drawio to PDF ------------------------------

    COUNTERC=0
    COUNTERU=0
    COUNTERtot=0

    for filename in ./figures/drawio/*.drawio; do

    if [ -n "$(git status ${filename} --porcelain)" ]; then
    echo " 🔁 ${filename} changed, converting..."
    DUMMY=$(rm "${filename}.pdf" 2>&1)
    if [[ "$OSTYPE" == "linux-gnu"* ]]; then
    DUMMY=$(drawio ${filename} --crop -x -o ${filename}.pdf 2>&1)
    elif [[ "$OSTYPE" == "msys"* ]]; then
    DUMMY=$(draw.io ${filename} --crop -x -o ${filename}.pdf 2>&1)
    fi
    COUNTERC=$((COUNTERC+1))
    else
    echo " ⤵️ ${filename} hasnt changed, skipping..."
    COUNTERU=$((COUNTERU+1))
    fi

    done
    printf "\n✔ DONE converting"
    COUNTERtot=$((COUNTERC+COUNTERU))
    echo -e "\n$COUNTERtot total \t $COUNTERC changed \t $COUNTERU skipped"
作者

GWJ

发布于

2023-12-25

更新于

2024-02-23

许可协议

评论