2

My requirement is need to get some text surrounded by a box like:

enter image description here

I tried with:

\documentclass{book}
\usepackage{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{tikz}

\usetikzlibrary{shadows}

\usepackage{lipsum}

\begin{document}

\begin{tcolorbox}[drop shadow west,
enhanced,colback=white,colframe=black!10]
\lipsum[1-2]
\end{tcolorbox}


\end{document}

But the output not like that what I need. Please advise...

Suggestion gave by Ignasi (thanks a lot) was working fine in PDFLaTeX and XeLaTeX, but I'm in need of using LaTeX -> dvips -> Ps2PDF, please advise for this...

1
  • 1
    The dvips driver have only limited fadings capability. They are supported but as the documentation clearly states "the results will not be as good as with a driver producing pdf as output".
    – campa
    Commented Jan 25, 2021 at 14:03

1 Answer 1

4

You can start looking at vignette tcolorbox library which allows to do inner fadings.

\documentclass{book}

\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\begin{document}

\begin{tcolorbox}[enhanced, colback=white, frame hidden,
underlay vignette={draw method=clipped, size=3mm, semi fade in=gray, east size=1.5mm, south size=1mm}]
\lipsum[1-2]
\end{tcolorbox}

\end{document}

enter image description here

Update: Different fadings

It's possible to decide the color and fading style for every side of the box.

\documentclass{book}

\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\begin{document}

\begin{tcolorbox}[enhanced, colback=white, frame hidden,
underlay vignette={draw method=clipped, size=3mm, semi fade in=gray, east size=1.5mm, south size=1mm}]
\lipsum[1-2]
\end{tcolorbox}

%semi fade in=gray, fixes fading for all four sides
%but `south style` and `east style` apply a particular fading
%
\begin{tcolorbox}[enhanced, colback=white, frame hidden,
underlay vignette={draw method=clipped, size=3mm, semi fade in=gray, east size=1.5mm, south size=1mm, south style={gray!10!white, path fading=east},
east style={gray!10!white, path fading=south}}]
\lipsum[1-2]
\end{tcolorbox}
\end{document}

enter image description here

10
  • Thanks for your quick suggestion, but I could get solid rules at all sides? I just copied your code and tried, is there anything I need to do further? Note that I'm using MikTeX 2.9 in Windows7, please advise...
    – MadyYuvi
    Commented Jan 25, 2021 at 11:40
  • @MadyYuvi Your picture doesn't show "solid rules at all sides", Do you want solid rules and inner fuzzi shadow?
    – Ignasi
    Commented Jan 25, 2021 at 11:53
  • Sorry for the confusion, I need the rules with inner fuzzi shadows, but if I execute your suggested code, I got the solid rules only, I didn't get the output what you pasted in your answer part, please advise if any mistake I did? Hope this is clear...
    – MadyYuvi
    Commented Jan 25, 2021 at 11:59
  • Please advise, should I include any library? I am using MikTeX 2.9 This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7140) (preloaded format=latex 2021.1.19) and LaTeX, dvips and ps2pdf
    – MadyYuvi
    Commented Jan 25, 2021 at 13:34
  • yes, my assumption is correct, it works well in PDFLaTeX and XeLaTeX, but when using dvips and ps2pdf all the rules are changed to solid one? Please advise how can I fix the same in LaTeX -> dvips -> ps2pdf? Please....
    – MadyYuvi
    Commented Jan 25, 2021 at 13:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .