Graphics, Figures & TablesCustom Quote Environment

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

Custom Quote Environment

Post by Myoldmopar »

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!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Custom Quote Environment

Post by localghost »

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.

    Code: Select all

    \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.
    A customized »quote« environment.
    mdframed-custom-quote.png (63.92 KiB) Viewed 8064 times
  2. A new »mdquote« environment created by the \newmdenv command.

    Code: Select all

    \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.
    The new »mdquote« environment.
    mdframed-mdquote-environment.png (63.94 KiB) Viewed 8064 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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
marco_d
Posts: 57
Joined: Tue Jan 20, 2009 7:49 pm

Custom Quote Environment

Post by marco_d »

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

Custom Quote Environment

Post by Myoldmopar »

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:

Code: Select all

\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

Custom Quote Environment

Post by Myoldmopar »

marco_d: That's also for your reply. I get a seemingly endless loop of responses that hover around DejaVu Sans:

Code: Select all

[~/Downloads/mdframed]
-> make docsty

	Typesetting mdframed.dtx
kpathsea: 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 DejaVuSans
This 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 directory
mktextfm: `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 DejaVuSans
This 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 directory
mktextfm: `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.

Thanks for your time!
Myoldmopar
Posts: 4
Joined: Sun Jul 08, 2012 3:52 am

Custom Quote Environment

Post by Myoldmopar »

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.
Post Reply