使用 TiKz 绘制的大引号无法编译

使用 TiKz 绘制的大引号无法编译

我的问题

抱歉给出这么长的代码,但我的问题出现在其中。

我不明白为什么下面给出的第一个长代码不起作用:更准确地说,问题来自使用 TiKz 绘制的大引号。我刚刚通过更改一些名称调整了第二个代码。有什么线索可以修复我的长代码吗?

有问题的代码

\documentclass[10pt,a4paper,french]{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyvrb}

\setlength{\parindent}{0cm}

\newcommand\bracket[1]{(#1)}

\newcommand\latex{\verb}
\DefineVerbatimEnvironment{Latex}{Verbatim}{numbers=left,numbersep=2mm}

% == PACKAGES USED == %

\usepackage{pgfkeys}

\usepackage[x11names,svgnames]{xcolor}
\usepackage{mdframed}
\usepackage{tikz}

\usepackage{babel}
\usepackage{csquotes}

% == DEF : quote == %

\makeatletter
% Inline mode
    \renewcommand\quote{%
        \@ifstar{\@quoteStar}{\@quoteNoStar}%
    }
    \newcommand\@quoteStar[2][]{%
        \textquote*[#1]{\textit{#2}}
    }
    \newcommand\@quoteNoStar[2][]{%
        \textquote[#1]{\textit{#2}}
    }

% Default settings for quoting blocks
    \definecolor{bigQuoteColorNormal}{named}{black}
    \definecolor{bigQuoteColorBack}{named}{LightBlue1}

    \newlength{\bigQuoteBorderWidth}
    \setlength{\bigQuoteBorderWidth}{0pt}
    \newlength{\bigQuoteInnerMargin}
    \setlength{\bigQuoteInnerMargin}{2pt}
    \newlength{\bigQuoteOuterMarginHorizontal}
    \setlength{\bigQuoteOuterMarginHorizontal}{15pt}

% Frame for quoting blocks
    \mdfdefinestyle{quoteFrameStyle}{
        fontcolor         = bigQuoteColorNormal,%
        backgroundcolor   = bigQuoteColorBack,%
        linewidth         = \bigQuoteBorderWidth,%
        leftmargin        = \bigQuoteOuterMarginHorizontal,%
        rightmargin       = \bigQuoteOuterMarginHorizontal,%
        innerleftmargin   = \bigQuoteInnerMargin,%
        innerrightmargin  = \bigQuoteInnerMargin,%
        innertopmargin    = \bigQuoteInnerMargin,%
        innerbottommargin = \bigQuoteInnerMargin,%
    }

% The big quotes
    \newcommand*\bigQuotefont{\fontfamily{fxl}} % selects Libertine for quote font

    \newcommand*{\bigQuoteOpening}{%
        \tikz[%
            remember picture,%
            overlay,%
            xshift=-15pt,%
            yshift=-10pt%
        ]
        \node (OQ) {\bigQuotefont\fontsize{60}{60}\selectfont``};
        \kern0pt
    }
    \newcommand*{\bigQuoteClosing}{%
        \tikz[
            remember picture,
            overlay,
            xshift=15pt,
            yshift=-10pt
        ]
        \node (CQ) {\bigQuotefont\fontsize{60}{60}\selectfont''};
    }

% Block mode
    \pgfkeys{
        /quote/.is family,
        /quote,
            author/.initial = {},
            title/.initial  = {},
            editor/.initial = {}
    }
    \newenvironment{Quote}[1][]{%
% Management of the keys.
        \pgfkeys{/quote, #1}
        \pgfkeysgetvalue{/quote/author}{\@author}
        \pgfkeysgetvalue{/quote/title}{\@title}
        \pgfkeysgetvalue{/quote/editor}{\@editor}
% Let's go !
        \medskip
        \begin{mdframed}[style=quoteFrameStyle]
        \quoteRefFormatBefore{\@author}%
                             {\@title}%
                             {\@editor}%
    }{%
        \quoteRefFormatAfter{\@author}%
                            {\@title}%
                            {\@editor}%
        \end{mdframed}
        \medskip
    }
% 1  -->  Author
% 2  -->  Title
% 3  -->  Editor
    \newcommand\quoteRefFormatBefore[3]{%
        \bigQuoteOpening % Problem !!!
    }
% 1  -->  Author
% 2  -->  Title
% 3  -->  Editor
    \newcommand\quoteRefFormatAfter[3]{{
        \footnotesize
        \par\smallskip
        \hfill #1
        \par
        \hfill \quote*{#2}
        \par
        \hfill {\scriptsize#3} \bigQuoteClosing % Problem !!!
    }}
\makeatother


\begin{document}

\bigQuoteOpening

\end{document}

大引号的工作代码

\documentclass[12pt]{article}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
%   \usepackage{libertine} % or any other font package (or none)
    \usepackage[svgnames]{xcolor}
    \usepackage{tikz}

% Make commands for the quotes
    \newcommand*\quotefont{\fontfamily{fxl}} % selects Libertine for quote font

    \newcommand*{\openquote}{%
        \tikz[
            remember picture,
            overlay,
            xshift=-15pt,
            yshift=-10pt
        ]
        \node (OQ) {\quotefont\fontsize{60}{60}\selectfont``};
        \kern0pt
    }
    \newcommand*{\closequote}{%
        \tikz[
            remember picture,
            overlay,
            xshift=15pt,
            yshift=-10pt
        ]
        \node (CQ) {\quotefont\fontsize{60}{60}\selectfont''};
    }

% wrap everything in its own environment
    \newenvironment{shadequote}{%
        \begin{quote}\openquote %
    }{%
        \hfill\closequote\end{quote} %
    }

    \usepackage{lipsum}
    \newcommand*\bigQuotefont{\fontfamily{fxl}} % selects Libertine for quote font

    \newcommand*{\bigQuoteClosing}{%
        \tikz[
            remember picture,
            overlay,
            xshift=15pt,
            yshift=-10pt
        ]
        \node (CQ) {\bigQuotefont\fontsize{60}{60}\selectfont''};
    }
\begin{document}

\lipsum[1]

\begin{shadequote}
A common mistake that people make when trying to design something completely
foolproof is to underestimate the ingenuity of complete fools.\par\emph{Douglas Adams}
\end{shadequote}

\lipsum[1]

\end{document}

答案1

这似乎有[french]{babel}关系。我删除包后它开始工作。然而,这不是引号的问题(babel对于某些语言来说,这会激活引号),因为当我删除它们时问题仍然存在。

相反,如果你写\tikz[<options>]{\node (<name>) { .. };}而不是
\tikz[<options>] \node (<name>) { .. };那么它可以很好地与一起工作babel


发生这种情况的原因是,这babel使得 成为;活动字符(例如~),并且\tikz宏将其视为结束标记。TikZ 足够聪明,可以识别 处于;活动状态的情况并进行调整。这里的问题是 被;改变为babel 在文档的开头( \begin{document})。在序言中它仍然是正常的!因为你将它存储在一个环境中,这些;s 是不活动的(catcodes 是在第一次读取字符时修复的),并且\tikz无法找到它们。如果你使用\tikz { \node {..}; }它,它会起作用,因为\tikz不需要寻找;。要处理的内部规则;是不同的(我认为 TikZ 总是检查正常或活动的;),所以内部\node {..};工作正常。

答案2

使用 pgf 2.1 CVS,第一个代码对我来说运行良好

 \usepackage[frenchb]{babel}  

 \usepackage[T1]{fontenc}   

如果你删除

 \usepackage[T1]{fontenc}  

主要代码但我删除了一些部分...

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{libertine}   
\usepackage{fancyvrb}
\usepackage[x11names,svgnames]{xcolor}
\usepackage{tikz}
\usepackage{mdframed}       
\usepackage[frenchb]{babel}   
\usepackage{csquotes} 

....

% The big quotes
    \newcommand*\bigQuotefont{\fontfamily{fxl}} % selects Libertine for quote font

    \newcommand*{\bigQuoteOpening}{%
        \tikz[%
            remember picture,%
            overlay,%
            xshift=-15pt,%
            yshift=-10pt%
        ]
        \node (OQ) {\bigQuotefont\fontsize{60}{60}\selectfont``}; 
        \kern0pt 
    }
    \newcommand*{\bigQuoteClosing}{%
       \tikz[
            remember picture,
            overlay,
            xshift=15pt,
            yshift=-10pt
        ]
        \node (CQ) {\bigQuotefont\fontsize{60}{60}\selectfont''}; 
    }

 ...


\begin{document}

\bigQuoteOpening 
A common mistake that people make when trying to design something completely
foolproof is to underestimate the ingenuity of complete fools.\par\emph{Douglas Adams} 
\bigQuoteClosing

\end{document}    

在此处输入图片描述

相关内容