[Tex/LaTex] Unwanted spaces

debuggingspacing

The code given just after produces extra unwanted spaces indicated in the following picture. How can I fix it ?

Sorry for the colors, this choices will be changed later when technical issues will be solved.

enter image description here

\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}

Best Answer

You have several spurious spaces in your input. Your dramatic indentation does not help in finding them.

\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}

How to find them? You see that end-of-lines where options are set (but apparently not when they are pgf options) are ignored (better, the spaces are stripped off). Conversely, end-of-lines are not ignored when something is to be typeset.

See, for example, your original

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

There are spurious spaces in lines 1 and 4. There were others: check for differences.

I've changed the code for the quotes, to make it more straight.

Related Question