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.

I made a new style of quoting. But I have to put the line height and width of the quote manually. Someone have a solution for make a environment with just 2 or 3 parameters? The quote, the author and the width of the quote environment?

Here is my code:

\def\linesize{1.50} % The height of my line
\begin{tikzpicture}
\draw[gray!75] (0,0) -- (0,\linesize);
\draw[gray!75] (0,0.5*\linesize) node [right] {Alfred de Musset};
\draw (0,0.5*\linesize) node [left] {%
\begin{minipage}{0.25\textwidth}
\begin{flushright}
Entre presque oui et oui, il y a tout un monde.
\end{flushright}
\end{minipage}
};
\end{tikzpicture}

And a second question, how to choose the text position of my quote? (right, left of the center line) all this in an environment?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Luckily TikZ processes the content of nodes as box so you can exchange the { .. } with \bgroup .. \egroup and split the picture there, so it is placed in a \begin{..} and \end{..}. The linesize parameter can also be added as argument or simply calculated from the quote size.

\documentclass{article}

\usepackage{tikz}

\def\linesize{1.50} % The height of my line
\newenvironment{myquote}[2]{%
    \begin{tikzpicture}
        \draw[gray!75] (0,0) -- (0,\linesize);
        \draw[gray!75] (0,0.5*\linesize) node [right] {#2};
        \draw (0,0.5*\linesize) node [left] \bgroup
            \begin{minipage}{#1}%
            \begin{flushright}%
}%
{%
            \end{flushright}%
            \end{minipage}%
        \egroup;
    \end{tikzpicture}
}

\begin{document}

\begin{myquote}{.5\textwidth}{A.U.~Thor}
    A quote is a quote is a quote!
\end{myquote}

\end{document}

Image

Here an advanced version which doesn't require \linesize and uses more of the TikZ parameter instead of manual environments:

\newenvironment{myquote}[2]{%
    \begin{tikzpicture}
        \draw [gray!75] node [right] {#2};
        \node (QUOTE) [left,text width={#1},text ragged left] \bgroup
}%
{%
        \egroup;
        \draw [gray!75]
            ([yshift=5pt]QUOTE.north east) -- ([yshift=-5pt]QUOTE.south east);
    \end{tikzpicture}
}

To change the quote the the right side instead you would need to change left to right and vice versa as well es change east to west in the second implementation. You could define your own options to do this, but this would be a little overkill. I would just define the environment again e.g. as star version, which uses the same definition but with that values exchanged.

share|improve this answer
    
Thanks ! It's perfect :D –  iDavid Jul 3 '11 at 20:43

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.