8

I know there has been some questions about the quote style, I loved the one with the big quote marks. What I'm trying to achieve it's a little simpler.

Right now I have something like this:

\documentclass[11pt]{report}

\usepackage{framed}
\usepackage{color}

\newenvironment{shadequote}%
{\begin{snugshade}\begin{quote}}
{\hfill\end{quote}\end{snugshade}}


\definecolor{shadecolor}{rgb}{0.9,0.9,0.9}

\begin{document}
Text before. Text before. Text before. Text before.
Text before. Text before. Text before. Text before.
Text before. Text before. Text before. 

\begin{shadequote}
Refactoring is the process of changing a software system in such a way
that it does not alter the external behavior of the code yet improves its
internal structure. It is a disciplined way to clean up code that minimizes
the chances of introducing bugs. In essence when you refactor you are improving
the design of the code after it has been written.
\end{shadequote}

Text after Text After Text after Text After Text after
Text After Text after Text After Text after Text After
Text after Text After Text after 
\end{document}

which does something like this:

enter image description here

Now, what I want to acomplish is this:

enter image description here

where the shading affects the text of the quote only.

Finally, I like the beamer output for quotes: enter image description here

But I've tried to change the quote with \itshape but it looks like crap, does beamer change font of quoted text?.

So, now the questions, first the technical question:

1. How can I acomplish the result shown on the second picture? (the shading affecting only the text part). Extra bonus: idem, but with the beamer look-n-feel The ideal answer would use the quote environment in order not to lose all its properties (like spaces, identation, etc.)

The appreciation question:

I know LaTeX do things for a good reason, sometimes I don't like it but then I realize I was wrong (the latest example is that when you put the twoside option, the right pages has more margin on the right side, at first I thought it should be the other way round), so, though it is a personal and subjective question, I want to know what you think:

2. Is it ok what I'm trying to achive? Should the shading affect only the text part or it's better in the first picture?

Of course, anything you may add or personal opinions are welcome

  • It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. – Peter Grill Apr 27 '13 at 18:08
  • I would recommend you have a look at mdframed and/or varwidth combination. – Peter Grill Apr 27 '13 at 18:09
  • @PeterGrill Added a MWE. I've tried to include (some time ago) the mdframed package and had some clashing problems. I didn't spend much time trying to fix it either. – Nico Apr 27 '13 at 18:45
8

Here is a version using the mdframed package. The first image below uses shadequote and the second image below uses the mdframed environment.

enter image description here

Code:

\documentclass[11pt]{report}
\usepackage{mdframed}
\usepackage{framed}
\usepackage{xcolor}

\mdfdefinestyle{MyShadeQuoteStyle}{%
    leftmargin=15pt,
    rightmargin=15pt,
    backgroundcolor=gray!25,
    linewidth=0pt,
    skipbelow=\topskip,
    skipabove=\topskip
}

\newenvironment{MyShadequote}[1][]{%
    \ignorespaces%
    \begin{mdframed}[style=MyShadeQuoteStyle,#1]%
}{%
    \end{mdframed}%
    \ignorespacesafterend%
}%


\newenvironment{shadequote}%
{\begin{snugshade}\begin{quote}}
{\hfill\end{quote}\end{snugshade}}


\definecolor{shadecolor}{rgb}{0.9,0.9,0.9}

\begin{document}
Text before. Text before. Text before. Text before.
Text before. Text before. Text before. Text before.
Text before. Text before. Text before. 

\begin{shadequote}
shadequote: Refactoring is the process of changing a software system in such a way
that it does not alter the external behavior of the code yet improves its
internal structure. It is a disciplined way to clean up code that minimizes
the chances of introducing bugs. In essence when you refactor you are improving
the design of the code after it has been written.
\end{shadequote}

Text after Text After Text after Text After Text after
Text After Text after Text After Text after Text After
Text after Text After Text after 

\begin{MyShadequote}
mdframed: Refactoring is the process of changing a software system in such a way
that it does not alter the external behavior of the code yet improves its
internal structure. It is a disciplined way to clean up code that minimizes
the chances of introducing bugs. In essence when you refactor you are improving
the design of the code after it has been written.
\end{MyShadequote}

Text after Text After Text after Text After Text after
Text After Text after Text After Text after Text After
Text after Text After Text after 
\end{document}
  • Thanks. I have tried to include the mdframed package some time ago but had some clashing problems. Joshua's answer does the trick without this package. – Nico Apr 27 '13 at 19:16
  • I've tried this solution and found some problems: first, it doesn't use the quote enviroment. It adds identation to the paragraph when quote doesn't (quotation does). Second, I'm having some trouble with the space above the quote, it seems to change in different quotes, but I don't know why. – Nico Apr 28 '13 at 23:37
5

To answer the second question first, the typeface in the third picture is slanted sans-serif, and you can get that with \sffamily and \slshape:

{\sffamily\slshape 
  El proceso de cambiar un sistema \dots
}

produces

example of slanted sans-serif text

To answer the first question second, I expect that the mdframed and varwidth packages might be much better, more useful, and more robust, but for a quick and dirty solution you can use the center environment with a minipage and a shaded environment:

\documentclass{article}

\newenvironment{shadequote}{%
  \begin{center}%
    \begin{minipage}{.8\linewidth}%
      \begin{shaded}%
        \sffamily\slshape}{%
      \end{shaded}
    \end{minipage}%
  \end{center}%
}

\usepackage{color}
\usepackage{framed}

\definecolor{shadecolor}{gray}{0.95}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. \dots

\begin{shadequote}
  El proceso de cambiar un sistema \dots
\end{shadequote}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, \dots

\end{document}

which produces

example of quick and dirty shaded quotation

I hope someone can provide a more robust answer, though.

  • That answers the bonus questions, thank you!. I've included that part to the definition of the shadedquote and worked, could you edit your answer to do that? Something like \newenvironment{shadequote}% {\begin{snugshade}\begin{quote}\sffamily\slshape} {\hfill\end{quote}\end{snugshade}} – Nico Apr 27 '13 at 18:49
  • Oh, new edit. The thing is I want to use \begin{quote}\end{quote} or \begin{shadedquote}\end{shadedquote} and then take care of the look-n-feel – Nico Apr 27 '13 at 18:50
  • Sure, the center/minipage/shaded approach can be combined to make an environment called shadequote. I updated the answer to do it that way (which also removes some redundancy between the two parts. – Joshua Taylor Apr 27 '13 at 18:55
  • It works, though you're not using the quote enviroment at all (hence throwing the margins, space and that kind of info). At a first glance, your answer has a little less vertical space from the previous text comparing to the quote environment. However, so far is the best answer and I like the results. – Nico Apr 27 '13 at 19:13
  • That is true, it is not using the quote or quotation environments. Those use list environments and don't seem to interact well with the environments provided by the framed package (e.g., shaded). I do not know whether the minipage based solution will work well if the quote spans pagebreaks. Solutions using mdframed will be better in that regard. – Joshua Taylor Apr 27 '13 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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