LaTeX forum ⇒ Graphics, Figures & TablesCustom 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

Postby Myoldmopar » Sun Jul 08, 2012 3:58 am

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!

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Sun Jul 08, 2012 11:09 am

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.
    1. \documentclass[11pt]{article}
    2. \usepackage[T1]{fontenc}
    3. \usepackage[framemethod=TikZ]{mdframed}
    4. \usepackage{lipsum} % create dummy text
    5.  
    6. \pagestyle{empty}
    7.  
    8. \surroundwithmdframed[
    9. topline=false,
    10. bottomline=false,
    11. skipabove=\topsep,
    12. skipbelow=\topsep
    13. ]{quote}
    14.  
    15. \begin{document}
    16. \lipsum[1]
    17.  
    18. \begin{quote}
    19. \lipsum[2]
    20. \end{quote}
    21.  
    22. \lipsum[3]
    23. \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 1957 times
  2. A new »mdquote« environment created by the \newmdenv command.
    1. \documentclass[11pt]{article}
    2. \usepackage[T1]{fontenc}
    3. \usepackage[framemethod=TikZ]{mdframed}
    4. \usepackage{lipsum} % create dummy text
    5.  
    6. \pagestyle{empty}
    7.  
    8. \newmdenv[
    9. leftmargin=\leftmargin,
    10. rightmargin=\leftmargin,
    11. topline=false,
    12. bottomline=false,
    13. skipabove=\topsep,
    14. skipbelow=\topsep
    15. ]{mdquote}
    16.  
    17. \begin{document}
    18. \lipsum[1]
    19.  
    20. \begin{mdquote}
    21. \lipsum[2]
    22. \end{mdquote}
    23.  
    24. \lipsum[3]
    25. \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 1957 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

Link:
BBcode:
HTML:
Hide post links
Show post links

marco_d
Posts: 57
Joined: Tue Jan 20, 2009 7:49 pm
Location: Hamburg, Germany

Postby marco_d » Sun Jul 08, 2012 5:07 pm

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. :-)

Link:
BBcode:
HTML:
Hide post links
Show post links

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

Postby Myoldmopar » Mon Jul 09, 2012 3:44 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:

  1. \documentclass{article}
  2.  
  3. \usepackage{mdframed}
  4.  
  5. \newmdenv[
  6. leftmargin=\leftmargin,
  7. rightmargin=\leftmargin,
  8. topline=false,
  9. bottomline=false,
  10. skipabove=\topsep,
  11. skipbelow=\topsep
  12. ]{mdquote}
  13.  
  14. \begin{document}
  15.  
  16. \begin{mdquote}
  17. Hello
  18. \end{mdquote}
  19.  
  20. \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!

Link:
BBcode:
HTML:
Hide post links
Show post links

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

Postby Myoldmopar » Mon Jul 09, 2012 3:50 am

marco_d: That's also for your reply. I get a seemingly endless loop of responses that hover around DejaVu Sans:
  1. [~/Downloads/mdframed]
  2. -> make docsty
  3.  
  4. Typesetting mdframed.dtx
  5. kpathsea: Invalid fontname `[lmroman10-regular]:mapping=tex-text', contains '['
  6.  
  7. kpathsea: Running mktextfm DejaVuSans
  8. /usr/share/texmf/web2c/mktexnam: Could not map source abbreviation D for DejaVuSans.
  9. /usr/share/texmf/web2c/mktexnam: Need to update /usr/share/texmf-texlive/fonts/map/dvips/skak/special.map?
  10. mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input DejaVuSans
  11. This is METAFONT, Version 2.718281 (TeX Live 2009/Debian)
  12.  
  13.  
  14. kpathsea: Running mktexmf DejaVuSans
  15. ! I can't find file `DejaVuSans'.
  16. <*> ...four; mag:=1; nonstopmode; input DejaVuSans
  17.  
  18. Please type another input file name
  19. ! Emergency stop.
  20. <*> ...four; mag:=1; nonstopmode; input DejaVuSans
  21.  
  22. Transcript written on mfput.log.
  23. grep: DejaVuSans.log: No such file or directory
  24. mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input DejaVuSans' failed to make DejaVuSans.tfm.
  25. kpathsea: Appending font creation commands to missfont.log.
  26.  
  27. kpathsea: Running mktextfm DejaVuSans
  28. /usr/share/texmf/web2c/mktexnam: Could not map source abbreviation D for DejaVuSans.
  29. /usr/share/texmf/web2c/mktexnam: Need to update /usr/share/texmf-texlive/fonts/map/dvips/skak/special.map?
  30. mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input DejaVuSans
  31. This is METAFONT, Version 2.718281 (TeX Live 2009/Debian)
  32.  
  33.  
  34. kpathsea: Running mktexmf DejaVuSans
  35. ! I can't find file `DejaVuSans'.
  36. <*> ...four; mag:=1; nonstopmode; input DejaVuSans
  37.  
  38. Please type another input file name
  39. ! Emergency stop.
  40. <*> ...four; mag:=1; nonstopmode; input DejaVuSans
  41.  
  42. Transcript written on mfput.log.
  43. grep: DejaVuSans.log: No such file or directory
  44. 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!

Link:
BBcode:
HTML:
Hide post links
Show post links

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

Postby Myoldmopar » Mon Jul 09, 2012 1:20 pm

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.

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests