LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Custom Quote Environment

Information and discussion about graphics, figures & tables in LaTeX documents.
Myoldmopar
Posts: 4
Joined: Sun Jul 08, 2012 3:52 am

Custom Quote Environment

Greetings,

I have spent a few hours searching the web for a custom quote environment. Most every result is someone wanting to attach a quotation to the chapter start, or to properly add large quotation marks to a fancy quotation.

What I would like is a simple addition to the quote environment: vertical rules on each side of it in the indented region.

The best possibility I found was using the mdframed package, but it doesn't come directly as a style file, rather a 'make your own'. I was able to run make docsty on it, but it spit out tons of errors. Even with these errors, a sty file was produced. However, when I try to use it and define a custom framed environment, it complains of unterminated brackets and fails.

I realize this isn't exactly a graphic, figure or table, but I couldn't decide on a better class to toss this in.

Thanks for any help!

localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany
Myoldmopar wrote:[…] The best possibility I found was using the mdframed package, but it doesn't come directly as a style file, rather a 'make your own'. I was able to run make docsty on it, but it spit out tons of errors. Even with these errors, a sty file was produced. […]

Packages are usually installed by the package manager of your TeX distribution (MiKTeX, TeX Live). So there is no need to do all these manual steps.
Myoldmopar wrote:[…] However, when I try to use it and define a custom framed environment, it complains of unterminated brackets and fails. […]

Your own efforts are best shown in form of code, that is to say a proper minimal example.

I see two possible solutions by the mdframed package with a slightly different result (both need the current package version).

1. The {quote} environment customized by the \surroundwithmdframed command.
\documentclass[11pt]{article}\usepackage[T1]{fontenc}\usepackage[framemethod=TikZ]{mdframed}\usepackage{lipsum}    % create dummy text \pagestyle{empty} \surroundwithmdframed[   topline=false,   bottomline=false,   skipabove=\topsep,   skipbelow=\topsep]{quote} \begin{document}   \lipsum[1]    \begin{quote}     \lipsum[2]   \end{quote}    \lipsum[3]\end{document}

The output is a quote indented on both sides with vertical rules in the distance of \textwidth (see picture).
A customized »quote« environment.
mdframed-custom-quote.png (63.92 KiB) Viewed 1984 times
2. A new »mdquote« environment created by the \newmdenv command.
\documentclass[11pt]{article}\usepackage[T1]{fontenc}\usepackage[framemethod=TikZ]{mdframed}\usepackage{lipsum}    % create dummy text \pagestyle{empty} \newmdenv[   leftmargin=\leftmargin,   rightmargin=\leftmargin,   topline=false,   bottomline=false,   skipabove=\topsep,   skipbelow=\topsep]{mdquote} \begin{document}   \lipsum[1]    \begin{mdquote}     \lipsum[2]   \end{mdquote}    \lipsum[3]\end{document}

The output here is also a quote indented on both sides but with the vertical rules in a distance of the quote width with the default indentation of the {quote} environment determined by \leftmargin (see picture).
The new »mdquote« environment.
mdframed-mdquote-environment.png (63.94 KiB) Viewed 1984 times

These are only very basic approaches. Both can be customized further as described in the mdframed manual.

Myoldmopar wrote:[…] I realize this isn't exactly a graphic, figure or table, but I couldn't decide on a better class to toss this in. […]

What about the »Text Formatting« sub-forum?

Important Notes

• The lipsum package is not part of the solution. It has only been used to create some dummy text and can be dropped in the actual document.

Best regards and welcome to the board
Thorsten
LaTeX Community Moderator

¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

marco_d
Posts: 57
Joined: Tue Jan 20, 2009 7:49 pm
Location: Hamburg, Germany
Myoldmopar wrote:I was able to run make docsty on it, but it spit out tons of errors.

make localinstall will help you. However which errors do you get? Using the current version you need also the cls-file.

regards
Marco
i am German. I can not use difficult words.

Myoldmopar
Posts: 4
Joined: Sun Jul 08, 2012 3:52 am
localghost:

Thanks for the information. I'll try to respond to each issue separately.

I am on Ubuntu 12.04 64. I have texlive-full installed, which installed as you know, a lot of packages. I have never had a missing package problem before now. I tried a MWE:

\documentclass{article} \usepackage{mdframed} \newmdenv[   leftmargin=\leftmargin,   rightmargin=\leftmargin,   topline=false,   bottomline=false,   skipabove=\topsep,   skipbelow=\topsep]{mdquote} \begin{document} \begin{mdquote}Hello\end{mdquote} \end{document}

...and I still get the error: LaTeX Error: File mdframed.sty' not found. This drove me to CTAN and found the package's site, only to find there wasn't a sty file directly, just build scripts and lots of examples. As I mentioned, the build script was having trouble as it was.

The mdframed documentation does show exactly what I need, and that is exactly what you wrote in your response, so once I can get mdframed going, I'll be on my way.

As for the text formatting sub-forum, I did consider it. However, in the description it mentions things like "bold, italic..." and I thought that was too character specific. But I'm happy to re-post or move if it would be a better locale!

Myoldmopar
Posts: 4
Joined: Sun Jul 08, 2012 3:52 am
marco_d: That's also for your reply. I get a seemingly endless loop of responses that hover around DejaVu Sans:
[~/Downloads/mdframed]-> make docsty 	Typesetting mdframed.dtxkpathsea: Invalid fontname [lmroman10-regular]:mapping=tex-text', contains '[' kpathsea: Running mktextfm DejaVuSans/usr/share/texmf/web2c/mktexnam: Could not map source abbreviation D for DejaVuSans./usr/share/texmf/web2c/mktexnam: Need to update /usr/share/texmf-texlive/fonts/map/dvips/skak/special.map?mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input DejaVuSansThis is METAFONT, Version 2.718281 (TeX Live 2009/Debian)  kpathsea: Running mktexmf DejaVuSans! I can't find file DejaVuSans'.<*> ...four; mag:=1; nonstopmode; input DejaVuSans Please type another input file name! Emergency stop.<*> ...four; mag:=1; nonstopmode; input DejaVuSans Transcript written on mfput.log.grep: DejaVuSans.log: No such file or directorymktextfm: mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input DejaVuSans' failed to make DejaVuSans.tfm.kpathsea: Appending font creation commands to missfont.log. kpathsea: Running mktextfm DejaVuSans/usr/share/texmf/web2c/mktexnam: Could not map source abbreviation D for DejaVuSans./usr/share/texmf/web2c/mktexnam: Need to update /usr/share/texmf-texlive/fonts/map/dvips/skak/special.map?mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input DejaVuSansThis is METAFONT, Version 2.718281 (TeX Live 2009/Debian)  kpathsea: Running mktexmf DejaVuSans! I can't find file DejaVuSans'.<*> ...four; mag:=1; nonstopmode; input DejaVuSans Please type another input file name! Emergency stop.<*> ...four; mag:=1; nonstopmode; input DejaVuSans Transcript written on mfput.log.grep: DejaVuSans.log: No such file or directorymktextfm: mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input DejaVuSans' failed to make DejaVuSans.tfm.

...and it keeps going until I ^D out of it.

So, why do I need a cls file? I mean, I downloaded the entire package from CTAN, and that includes the cls file among several other files. However, I shouldn't need to use this cls file as my document class just to have access to the mdframed package, right? -- Based on localghost's example I think I definitely don't.

Myoldmopar
Posts: 4
Joined: Sun Jul 08, 2012 3:52 am
After some more trying, I found that I apparently have TeXLive 2009:
-> tex -v
TeX 3.1415926 (TeX Live 2009/Debian)
...

I found this in looking for why I don't have access to tlmgr to install mdframed, or some of its dependencies (http://tex.stackexchange.com/questions/29274).

When I get to a better internet connection, I may try to do a reinstall of texlive-full and see if it brings it up to 2011, and all these problems may go away.