Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have defined myself a new environment as below:


What I would like to do here is to be able to format this by adding borders. all borders needs to be solid but the left border needs to be thicker.

What is the way?

share|improve this question
Use mdframed. It allows for breaking across pages as well. –  Werner Nov 11 '11 at 18:35
ok, it is nice but not what I want. Is there some way to specify borders like we do with css. I know it is so wrong to reference css here but it is kind of nice to be that flexible. –  tugberk Nov 11 '11 at 18:44
@MarcoDaniel it was a typo. if you can refresh the page you will see that it was corrected by cmhughes. –  tugberk Nov 11 '11 at 18:47
@tugberk: mdframed doesn't support css style. You can use \mdfdefinestyle to define your own style. At the moment I have no separate line specification implemented. But with the framemethod=default it should be very simple. –  Marco Daniel Nov 11 '11 at 18:52
@MarcoDaniel no, that's not what I meant. I am not looking for a css support here. I am looking for something similar to that. If you can provide me sample, that would be fine. I am now going through the documentation of your package mdframed. –  tugberk Nov 11 '11 at 18:56
show 1 more comment

4 Answers

up vote 7 down vote accepted

Here a solution with mdframed. You have two new keys: addleftlinewidth and addleftlinecolor to modify the additional setting:









enter image description here

At the moment only the single frame is supported.

share|improve this answer
this is a cool solution. I am looking for a gray border but I guess it is not so difficult to change. Also, is there any support inside you package for margin and padding? –  tugberk Nov 11 '11 at 19:45
I tried the code it didn't compile. I gives bunch of errors. I am using lots of packages and I am guessing they are not playing nice together. –  tugberk Nov 11 '11 at 19:58
well I get bunch of them. here is the first one: "option clash for package mdframed. \mkaetletter" I mean really I am the only one who is bothered with this. How hard can it be to put borders. IMO, something missing at the core level for TeX or I am Really looking at the WRONG direction. –  tugberk Nov 11 '11 at 20:47
let us continue this discussion in chat –  Marco Daniel Nov 11 '11 at 21:22
add comment

You could use the adjustbox package to add a frame around it, then clip some sides of the frame to make them thinner.

I removed the quote and replaced it with a centered minipage, because that's simpler to handle with adjustbox. However, it can't be broken across pages.

There is no direct CSS-like way to define frames or borders. Some of the adjustbox keys allow for 1, 2 or 4 arguments like some CSS settings do (see the manual for more), but that's it. In LaTeX you basically always have to box the content in question and then draw lines around it dependent on its size. If you want anything special like a frame only on one side (or that one thicker) than you can also use a drawing package like TikZ or PSTricks to do this. Actually the mentioned mdframe package does uses on of these.



        minipage=\linewidth-0.6in, % to get your 2x0.3in border
        fbox=2pt, % 2pt frame all around
        Clip=0pt 1pt 1pt 1pt, % remove 1pt of the bottom, top and right frame
        center % center the whole thing (around \linewidth)





share|improve this answer
That's a good example. Thanks. With LaTeX we can nearly do anything we want logical but we always need other stuff around. For example, here I also need padding inside the framed box and margins around it. I know this is another topic. I am just expressing I haven't been able to find the core logic of TeX so far. Maybe I am looking at the wrong direction. –  tugberk Nov 11 '11 at 19:18
Margins and padding can be added using the margin key. Just use it before the fbox for padding and after for a margin. –  Martin Scharrer Nov 11 '11 at 19:21
add comment

if you do not need a pagebreak its really simple:

              \vrule width 5pt}p{\dimexpr\linewidth-0.6in-2\tabcolsep-5pt\relax}|}\hline}

foo bar baz

enter image description here

share|improve this answer
add comment

Using mdframed is probably the way to go if you need to be able to cross page boundaries. Instead of thicker lines, you could also use tikz with shadows to highlight the desired edges. Here I have adapted the solution from New command for a height-flexible rect. Not only can you can adjust the values of xshift to get a thicker shadow, but the full power available of tikz is available to customize as you desire:

enter image description here


\tikzstyle{shadedbox} = [
  text width=0.97\linewidth,
  shade, top color=white, bottom color=white,
  drop shadow={
    top color=black,
    bottom color=black,
    shadow xshift=-1.5pt,% add shading on left
    shadow yshift=-0.5pt,% 0pt removes shading at bottom

    \node [shadedbox, #1] (box) {#2};%

\newcommand{\ShortLoremIpsum}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam turpis turpis, rutrum vel facilisis nec, scelerisque ut nisi. 

Proin et elit sapien. Ut non ante tellus. Pellentesque et tempus metus. Phasellus sit amet est nisl, a varius elit. Nunc nunc magna, molestie sit amet fermentum a, facilisis at urna.



\myquote[bottom color=yellow!10]{\ShortLoremIpsum}

\myquote[rounded corners=5pt, line width=1.0pt, draw=blue]{\ShortLoremIpsum}

\myquote[text width=0.6\linewidth, top color=red!10, densely dotted]{\ShortLoremIpsum}
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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