我感兴趣的是页面之间的方框文字第二版:带有 mdframed 的练习框。如何添加:垂直阴影框架标题和带有阴影的垂直阴影框?
是的,我在这里看到了几个阴影和垂直阴影的例子,但它们使用的样式我无法放入 mdframed 中。
这是另一个例子。2 个问题:1.我如何才能改变圆形标题框阴影的大小?2.我如何才能删除那个红色的标题框?或者另一种方法是从顶部开始着色,包括矩形标题框
\documentclass{article}
\usepackage[a5paper]{geometry}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{amsmath,amssymb}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{shapes.symbols}
\usetikzlibrary{shadows}
\usetikzlibrary{calc}
\usepackage{lipsum}
\newcounter{exe}
\newenvironment{Fancybox}[1][.5\textwidth]
{%
\stepcounter{exe}%
\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=8pt]
\node[draw=blue!40,anchor=east,rectangle, thick,font=\color{black}, double,
top color=blue!40,
bottom color=blue!5,
rounded corners=8pt,
drop shadow,
]
{\strut Exercise~\theexe};},%
skipabove=\topskip,
skipbelow=\topskip,
innertopmargin=1pt,
apptotikzsetting={\tikzset{mdfbackground/.append style={top color=blue!40, bottom color=white}}},
linecolor=blue,%
innerlinewidth=1pt,
topline=true,
shadow=true,
rightline=true,innerleftmargin=10,innerrightmargin=10,
frametitlerule=false,
frametitlebackgroundcolor=red,
shadowcolor=blue!40,
frametitleaboveskip=\dimexpr-\ht\strutbox\relax,
roundcorner=5pt,
singleextra={\path let \p1=(P), \p2=(O) in node[fill=blue!40,font=\color{black}] at (P|-0,0.5*\y2+0.5*\y1) {$\clubsuit$};}
}
\begin{mdframed}[userdefinedwidth=#1]\allowdisplaybreaks\relax%
}
{\end{mdframed}}
\begin{document}
\lipsum[1-4]
\begin{Fancybox}[1\textwidth]
\begin{align}
\dot{n} &= u\cos\psi -v\sin\psi \\
\dot{e} &= u\sin\psi + v\cos\psi
\end{align}
For small angles the following approximation can be used:
\begin{align}
\dot{n} &= u -v\delta_\psi \\
\dot{e} &= u\delta_\psi + v
\end{align}
\end{Fancybox}
\begin{Fancybox}[1\textwidth]
\begin{align}
\dot{n} &= u\cos\psi -v\sin\psi \\
\dot{e} &= u\sin\psi + v\cos\psi
\end{align}
For small angles the following approximation can be used:
\begin{align}
\dot{n} &= u -v\delta_\psi \\
\dot{e} &= u\delta_\psi + v
\end{align}
\end{Fancybox}
\end{document}
答案1
一个选项是使用singleextra
,firstextra
来放置标题,而不是frametitle
; 这样,您可以轻松获得所需的背景阴影效果。要控制阴影属性,您可以使用所有可用的键,例如scale
, xshift
, yshift
(请参阅 PGF 手册)。对于没有分页符的框架,在右侧垂直中间添加了一个装饰(根据评论中的要求):
\documentclass{article}
\usepackage[a6paper]{geometry}% just for the example
\usepackage[framemethod=tikz]{mdframed}
\usepackage{amsmath,amssymb}
\usetikzlibrary{calc}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{shapes.symbols}
\usetikzlibrary{shadows}
\newcounter{exe}
\newenvironment{Fancybox}[1][\textwidth]
{\stepcounter{exe}%
\mdfsetup{
singleextra={%
\node[draw=blue!40,anchor=east,rectangle, thick,font=\color{black}, double,
top color=blue!40,
bottom color=blue!5,
rounded corners=8pt,
drop shadow={shadow xshift=1.5pt, shadow yshift=-1.5pt},anchor=west
] at ([xshift=20pt]O|-P)
{\strut Example~\theexe};
\path let \p1=(P), \p2=(O) in node[fill=blue!40,font=\color{white}] at (P|-0,0.5*\y2+0.5*\y1) {$\clubsuit$};},%
firstextra={%
\node[draw=blue!40,anchor=east,rectangle, thick,font=\color{black}, double,
top color=blue!40,
bottom color=blue!5,
rounded corners=8pt,
drop shadow={shadow xshift=1.5pt, shadow yshift=-1.5pt},anchor=west
] at ([xshift=20pt]O|-P)
{\strut Example~\theexe};},%
skipabove=\topskip,
skipbelow=\topskip,
innertopmargin=18pt,
linecolor=red,%
innerlinewidth=0.8pt,
topline=true,
apptotikzsetting={\tikzset{mdfbackground/.append style={%
shade,top color=blue!35, bottom color=white}}},
frametitleaboveskip=\dimexpr-\ht\strutbox\relax,
roundcorner=5pt,
linecolor=blue,%
innerlinewidth=1pt,
topline=true,
shadow=true,
rightline=true,innerleftmargin=10,innerrightmargin=10,
shadowcolor=blue!40,
}
\begin{mdframed}[userdefinedwidth=#1]\relax%
}
{\end{mdframed}}
\begin{document}
\begin{Fancybox}
To calculate the horizontal position the kinematic differential
equations are needed:
\begin{align}
\dot{n} &= u\cos\psi -v\sin\psi \\
\dot{e} &= u\sin\psi + v\cos\psi
\end{align}
For small angles the following approximation can be used:
\begin{align}
\dot{n} &= u -v\delta_\psi \\
\dot{e} &= u\delta_\psi + v
\end{align}
\end{Fancybox}
\begin{Fancybox}
To calculate the horizontal position the kinematic differential
equations are needed:
\begin{align}
\dot{n} &= u\cos\psi -v\sin\psi \\
\dot{e} &= u\sin\psi + v\cos\psi
\end{align}
For small angles the following approximation can be used:
\begin{align}
\dot{n} &= u -v\delta_\psi \\
\dot{e} &= u\delta_\psi + v
\end{align}
For small angles the following approximation can be used:
\begin{align}
\dot{n} &= u -v\delta_\psi \\
\dot{e} &= u\delta_\psi + v
\end{align}
\end{Fancybox}
\begin{Fancybox}[7cm]
To calculate the horizontal position the kinematic differential equations are needed:
\begin{align}
\dot{n} &= u -v\delta_\psi \\
\dot{e} &= u\delta_\psi + v
\end{align}
\end{Fancybox}
\end{document}