tikz-cd 无法编译手册中的示例

tikz-cd 无法编译手册中的示例

我不知道这是我的本地 TeX-Distribution(macTeX 2018)的问题还是 tikz-cd 本身的问题,但是:我无法从 tikz-cd 手册中编译基本示例,如下所示:

    \documentclass{standalone}
    \usepackage[utf8]{inputenc}
    \usepackage[ngerman]{babel}
    \usepackage{xcolor}

    \usepackage[T1]{fontenc}
    \usepackage{lmodern}

    \usepackage{amsmath, amssymb}


    \usepackage{tikz-cd}

    \begin{document}

    \begin{tikzcd}
        A \arrow[r, "\phi"] \arrow[d, red]
                & B \arrow[d, "\psi" red] \\
        C \arrow[r, red, "\eta" blue]
            &D \end{tikzcd}

    \end{document}

输出结果为 编译文件

日志中的错误消息以此错误消息开头:

    ! Argument of \language@active@arg" has an extra }.
<inserted text> 
                \par 
l.18        &D \end{tikzcd}

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
! Paragraph ended before \language@active@arg" was complete.
<to be read again> 
                   \par 
l.18        &D \end{tikzcd}

知道问题可能出在哪里吗?截至 2019 年 4 月 4 日,macTeX-Distribution 已完成并保持最新状态。

答案1

为了解决您的问题,您可以添加\usetikzlibrary{babel}始终确认您可以使用\usepackage[ngerman]{babel}。现在没有错误。

在此处输入图片描述

    \documentclass{standalone}
    \usepackage[utf8]{inputenc}
    \usepackage[ngerman]{babel}
    \usepackage{xcolor}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    \usepackage{amsmath, amssymb}
    \usepackage{tikz-cd}
    \usetikzlibrary{babel}
    \begin{document}
    \begin{tikzcd}
        A \arrow[r, "\phi"] \arrow[d, red]
                & B \arrow[d, "\psi" red] \\
        C \arrow[r, red, "\eta" blue]
            &D 
    \end{tikzcd}
    \end{document}

相关内容