Featured Book

LaTeX Beginners Guide

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 2 guests

Partner Sites

TeXwelt - Fragen und Antworten goLaTeX
TeXblog
TeXnicCenter
TeXample

Custom Quote Environment

Add tags Information and discussion about graphics, figures & tables in LaTeX documents.

Custom Quote Environment

Postby Myoldmopar on Sun Jul 8th, 2012

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!
Myoldmopar
 
Posts: 4
Joined: Sun Jul 8th, 2012

Re: Custom Quote Environment

Postby localghost on Sun Jul 8th, 2012

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  •  Open in writeLaTeX
    \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).
    mdframed-custom-quote.png
    A customized »quote« environment.
    mdframed-custom-quote.png (63.92 KiB) Viewed 1149 times
  2. A new »mdquote« environment created by the \newmdenv command.
    Code: Select all  •  Open in writeLaTeX
    \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).
    mdframed-mdquote-environment.png
    The new »mdquote« environment.
    mdframed-mdquote-environment.png (63.94 KiB) Viewed 1149 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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses
User avatar
localghost
Site Moderator
 
Posts: 9219
Joined: Fri Feb 2nd, 2007
Location: Braunschweig, Germany

Re: Custom Quote Environment

Postby marco_d on Sun Jul 8th, 2012

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. :-)
marco_d
 
Posts: 57
Joined: Tue Jan 20th, 2009
Location: Hamburg, Germany

Re: Custom Quote Environment

Postby Myoldmopar on Mon Jul 9th, 2012

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  •  Open in writeLaTeX
\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 8th, 2012

Re: Custom Quote Environment

Postby Myoldmopar on Mon Jul 9th, 2012

marco_d: That's also for your reply. I get a seemingly endless loop of responses that hover around DejaVu Sans:
Code: Select all  •  Open in writeLaTeX
[~/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 8th, 2012

Re: Custom Quote Environment

Postby Myoldmopar on Mon Jul 9th, 2012

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.
Myoldmopar
 
Posts: 4
Joined: Sun Jul 8th, 2012


Return to Graphics, Figures & Tables

Who is online

Users browsing this forum: No registered users and 2 guests