Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
Glad you were warned. You have no idea how much time I spent getting to the bottom of a similar problem: Tex Capacity Exceeded (if remove % after use of macro). From that MWE it does not seem complicated, but it took me a while to get it down to that stage. –  Peter Grill Apr 18 '12 at 0:54
    
So, I pretty much put a trailing % everywhere in my preamble: When is it harmful to add percent character at end of lines in a \newcommand, or similar –  Peter Grill Apr 18 '12 at 0:54
    
Thanks a lot for this two links. –  projetmbc Apr 18 '12 at 8:18

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
I was warned... So I see now that I must be more carefull with my intentation. Thanks for fixing this spurious spaces ! –  projetmbc Apr 17 '12 at 22:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.