不需要的空间

不需要的空间

刚刚给出的代码产生了下图所示的额外不需要的空格。我该如何修复它?

抱歉,颜色有问题,技术问题解决后这些选择将会更改。

在此处输入图片描述

\documentclass[10pt,a4paper,french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[x11names,svgnames]{xcolor}
\usepackage{mdframed}
%\usepackage{pgfkeys} % Already loaded by tikz.
\usepackage{tikz}
\usepackage{babel}
\usepackage{csquotes}

\setlength{\parindent}{0cm}

\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{bigQuoteColorText}{named}{black}
    \definecolor{bigQuoteColorSymbol}{named}{blue}
    \definecolor{bigQuoteColorBack}{named}{LightBlue1}

    \newlength{\bigQuoteBorderWidth}
    \setlength{\bigQuoteBorderWidth}{0pt}
    \newlength{\bigQuoteInnerMargin}
    \setlength{\bigQuoteInnerMargin}{2pt}
    \newlength{\bigQuoteOuterMarginHorizontal}
    \setlength{\bigQuoteOuterMarginHorizontal}{1.4em}

% Frame for quoting blocks
    \mdfdefinestyle{quoteFrameStyle}{
        fontcolor         = bigQuoteColorText,%
        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=0.65em,%
            yshift=-1.35em%
        ]{\node (OQ) {\bigQuotefont\fontsize{32}{32}\selectfont\color{bigQuoteColorSymbol}\textbf{``}};}
        \kern0pt
    }
    \newcommand*{\bigQuoteClosing}{%
        \tikz[
            remember picture,
            overlay,
            xshift=1.3em,
            yshift=-0.35em
        ]{\node (CQ) {\bigQuotefont\fontsize{32}{32}\selectfont\color{bigQuoteColorSymbol}\textbf{''}};}
        \kern0pt
    }

% 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
        \bigQuoteOpening
        \begin{mdframed}[style=quoteFrameStyle]
    }{%
        \quoteRefFormatAfter{\@author}%
                            {\@title}%
                            {\@editor}
        \bigQuoteClosing %
        \end{mdframed}
        \medskip
    }
% 1  -->  Author
% 2  -->  Title
% 3  -->  Editor
    \newcommand\quoteRefFormatAfter[3]{{
        \footnotesize
        \par\smallskip
        \hfill #1
        \par
        \hfill \quote*{#2} %
        \par
        \hfill{\scriptsize#3}% Problem !!!
    }}
\makeatother


\begin{document}

\begin{Quote}[%
    author = Pierre Desproges,%
    title  = La Minute nécessaire de monsieur Cyclopède,%
    editor = Éditions du Seuil%
]
    Le but de l’homme moderne sur cette terre est
    à l’évidence de s’agiter sans réfléchir dans
    tous les sens, afin de pouvoir dire fièrement,
    à l’heure de sa mort :
    \quote{Je n’ai pas perdu mon temps.}.
\end{Quote}

\end{document}

答案1

您的输入中有多个虚假空格。您的大幅缩进无助于找到它们。

\documentclass[10pt,a4paper,french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[x11names,svgnames]{xcolor}
\usepackage{mdframed}
%\usepackage{pgfkeys} % Already loaded by tikz.
\usepackage{tikz}
\usepackage{babel}
\usepackage{csquotes}

\setlength{\parindent}{0cm}

\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{bigQuoteColorText}{named}{black}
\definecolor{bigQuoteColorSymbol}{named}{blue}
\definecolor{bigQuoteColorBack}{named}{LightBlue1}

\newlength{\bigQuoteBorderWidth}
\setlength{\bigQuoteBorderWidth}{0pt}
\newlength{\bigQuoteInnerMargin}
\setlength{\bigQuoteInnerMargin}{2pt}
\newlength{\bigQuoteOuterMarginHorizontal}
\setlength{\bigQuoteOuterMarginHorizontal}{1.4em}

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

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

\newcommand*{\bigQuoteOpening}{%
  \tikz[remember picture,
        overlay,
        xshift=0.65em,
        yshift=-1.35em]
    {\node (OQ) {\bigQuotefont\color{bigQuoteColorSymbol}\textbf{``}};}%
  \kern0pt
}
\newcommand*{\bigQuoteClosing}{%
  \tikz[remember picture,
        overlay,
        xshift=1.3em,
        yshift=-0.35em]
    {\node (CQ) {\bigQuotefont\color{bigQuoteColorSymbol}\textbf{''}};}%
  \kern0pt
}

% 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
   \bigQuoteOpening
   \begin{mdframed}[style=quoteFrameStyle]}
  {\quoteRefFormatAfter{\@author}{\@title}{\@editor}%
   \bigQuoteClosing
   \end{mdframed}%
   \medskip}
% 1  -->  Author
% 2  -->  Title
% 3  -->  Editor
\newcommand\quoteRefFormatAfter[3]{{%
  \footnotesize
  \par\smallskip
  \hfill #1\par
  \hfill \quote*{#2}\par
  \hfill{\scriptsize#3}%
}}
\makeatother


\begin{document}

\begin{Quote}[%
    author = Pierre Desproges,%
    title  = La Minute nécessaire de monsieur Cyclopède,%
    editor = Éditions du Seuil%
]
    Le but de l’homme moderne sur cette terre est
    à l’évidence de s’agiter sans réfléchir dans
    tous les sens, afin de pouvoir dire fièrement,
    à l’heure de sa mort :
    \quote{Je n’ai pas perdu mon temps.}.
\end{Quote}

\end{document}

如何找到它们?你会看到,设置选项的行尾pgf会被忽略(但显然当它们是选项时不会被忽略)(更好的是,空格会被删除)。相反,行尾是不是当需要排版某些内容时,请忽略。

例如,参见您的原文

\newcommand\quoteRefFormatAfter[3]{{
    \footnotesize
    \par\smallskip
    \hfill #1
    \par
    \hfill \quote*{#2} %
    \par
    \hfill{\scriptsize#3}% Problem !!!
}}

第 1 行和第 4 行中有虚假空格。还有其他空格:检查差异。

我更改了引号的代码,使其更加直接。

相关内容