Microtype 包与 baposter 中的 TikZ 交互(“放弃这条路径......”错误)

Microtype 包与 baposter 中的 TikZ 交互(“放弃这条路径......”错误)

我正在制作一张海报,使用baposter.cls(可以得到它这里)。我想使用microtype包来增加 headerbox 标题中字母的间距,但是遇到了 TikZ 错误:Package tikz Error: Giving up on this path. Did you forget a semicolon?. }

我使用 Atom 和 latexmk 进行编译,但我也尝试了 TeXStudio,错误仍然存​​在。我正在运行最新版本的 MikTeX。

最小工作示例

我保留了所有的字体包,因为它们可能会导致错误。

\documentclass[portrait,final,a0paper,fontscale=0.277]{baposter}

%% Fonts
\usepackage{bookman}
\usepackage[eulergreek]{sansmath}\sansmath
\usepackage{upgreek}
\usepackage[T1]{fontenc}

\usepackage{anyfontsize}
\usepackage[normalem]{ulem}
\usepackage{lipsum}

% https://tex.stackexchange.com/questions/62346/enlarging-tracking-letter-spacing
\usepackage[letterspace=50]{microtype}

\begin{document}
\begin{poster}%
{% poster options
    grid=false,%
    columns=3,%
    colspacing=1.5em,%
    bgColorOne=white,%
    borderColor=black,%
    headerColorOne=black,%
    headerFontColor=white,%
    boxColorOne=white,%
    textborder=rectangle,%roundedsmall,%
    headerborder=none,%
    headerheight=0.1\textheight,%
    headershape=rectangle,%smallrounded,%
    headershade=plain,%
    headerfont=\fontsize{11}{1}\selectfont\sf\lsstyle,%
    headerheight=0.13\textheight,%
    textfont={\setlength{\parindent}{1.5em}}\fontsize{7.5}{10}\selectfont\sf,%
    boxshade=plain,%
    background=plain,%
    linewidth=1pt%
}{}{Title}{author}{}{}

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    %%
    \headerbox{foo}%
    {name=ceas, column=0, row=0, span=3}%
    {
        \vspace{0.5em}
        \lipsum[1-4]
    }

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \headerbox{bar}%
    {name=foo, column=0, span=3, below=ceas}%
    {
        \vspace{0.5em}
        \lipsum[5-8]
    }

\end{poster}
\end{document}

上述代码重现了错误。如果注释掉\lsstyle(即 microtype 命令),错误就会消失。

答案1

代码中存在几个缺陷。幸运的是,这个缺陷很容易修复。

\documentclass[portrait,final,a0paper,fontscale=0.277]{baposter}

%% Fonts
\usepackage{bookman}
\usepackage[eulergreek]{sansmath}\sansmath
\usepackage{upgreek}
\usepackage[T1]{fontenc}

\usepackage{anyfontsize}
\usepackage[normalem]{ulem}
\usepackage{lipsum}
\usepackage{etoolbox}

% https://tex.stackexchange.com/questions/62346/enlarging-tracking-letter-spacing
\usepackage[letterspace=500]{microtype}

\makeatletter
\patchcmd\poster
 {\baposter@box@headerfont{\baposter@box@title}}
 {{\baposter@box@headerfont\baposter@box@title}}
 {}{}
\makeatother




\begin{document}
\begin{poster}%
{% poster options
    grid=false,%
    columns=3,%
    colspacing=1.5em,%
    bgColorOne=red,%
    borderColor=black,%
    headerColorOne=blue,%
    headerFontColor=white,%
    boxColorOne=white,%
    textborder=rectangle,%roundedsmall,%
    headerborder=none,%
    headerheight=0.1\textheight,%
    headershape=rectangle,%smallrounded,%
    headershade=plain,%
    headerfont=\fontsize{11}{13}\sffamily\lsstyle,%
    headerheight=0.13\textheight,%
    textfont={\setlength{\parindent}{1.5em}}\fontsize{7.5}{10}\sffamily,%
    boxshade=plain,%
    background=plain,%
    linewidth=1pt%
}{}{Title}{author}{}{}

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    %%
    \headerbox{foo}%
    {name=ceas, column=0, row=0, span=3}%
    {
        \vspace{0.5em}
        \lipsum[1-4]
    }

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \headerbox{bar}%
    {name=foo, column=0, span=3, below=ceas}%
    {
        \vspace{0.5em}
        \lipsum[5-8]
    }

\end{poster}
\end{document}

我用来500强调字母间距已完成。

在此处输入图片描述

请注意,该功能\sf已被弃用 20 多年了。

相关内容