我在 texample.net 上发现了这些漂亮的盒子:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes}
\usepackage{amsmath,amssymb}
\begin{document}
%
% Define box and box title style
\tikzstyle{mybox} = [draw=red, fill=blue!20, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=red, text=white]
%
%
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.50\textwidth}
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{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {A fancy title};
\node[fancytitle, rounded corners] at (box.east) {$\clubsuit$};
\end{tikzpicture}%
%
\tikzstyle{mybox} = [draw=blue, fill=green!20, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=blue, text=white, ellipse]
%
\begin{tikzpicture}[transform shape, rotate=10, baseline=-3.5cm]
\node [mybox] (box) {%
\begin{minipage}[t!]{0.5\textwidth}
Fermat's Last Theorem states that
\[
x^n + y^n = z^n
\]
has no non-zero integer solutions for $x$, $y$ and $z$ when $n > 2$.
\end{minipage}
};
\node[fancytitle] at (box.north) {Fermat's Last Theorem};
\end{tikzpicture}
%
\end{document}
我尝试做这样的事情:
我希望方框停留在页面的角落,而分子停留在页面的中心。但我不知道该怎么做。到目前为止,我得到的是:
\documentclass[12pt]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{shapes,decorations}
\usepackage{float}
\usepackage{chemfig}
\setdoublesep{0.357 em}
\setchemrel{0pt}{1.785 em}{2.785 em}
\setatomsep{1.785 em}
\setbondoffset{0.18265 em}
\setbondstyle{line width=0.0642}
\begin{document}
\tikzstyle{mybox} = [draw=black, fill=blue!20, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=black, text=white]
%
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.5\textwidth}
Hier werden die chemisch-physikalischen Eigenschaften gelistet sein.
\end{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {Physikalisch-chemische Eigenschaften};
\end{tikzpicture}
%
\tikzstyle{mybox} = [draw=blue, fill=green!20, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=blue, text=white, ellipse]
%
\begin{tikzpicture}
\node [mybox] (box) {%
\begin{minipage}{0.5\textwidth}
Hier sollen die pharmakodynamischen Parameter stehen!
\end{minipage}
};
\node[fancytitle] at (box.north) {Pharmakodynamik};
\end{tikzpicture}
%
\begin{figure}[H]
\centering
\chemfig{*6(=(-[:-90]OH)-=-(-[:90]N(-[:150]H)-[:30](=O)-[:-30]CH_3)=-)}
\caption{Paracetamol}
\end{figure}
%
\tikzstyle{mybox} = [draw=black, fill=blue!20, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=black, text=white]
%
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.5\textwidth}
Hier werden die chemisch-physikalischen Eigenschaften gelistet sein.
\end{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {Physikalisch-chemische Eigenschaften};
\end{tikzpicture}
%
\tikzstyle{mybox} = [draw=blue, fill=green!20, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=blue, text=white, ellipse]
%
\begin{tikzpicture}
\node [mybox] (box) {%
\begin{minipage}{0.5\textwidth}
Hier sollen die pharmakodynamischen Parameter stehen!
\end{minipage}
};
\node[fancytitle] at (box.north) {Pharmakodynamik};
\end{tikzpicture}
%
\end{document}
答案1
像这样吗?
\documentclass[12pt]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{shapes,decorations}
\usepackage{float}
\usepackage{chemfig}
\setdoublesep{0.357 em}
\setchemrel{0pt}{1.785 em}{2.785 em}
\setatomsep{1.785 em}
\setbondoffset{0.18265 em}
\setbondstyle{line width=0.0642}
\begin{document}
\tikzstyle{mybox} = [draw=black, fill=blue!20, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=black, text=white]
%
\begin{tikzpicture}[remember picture,overlay]
\node [mybox,anchor=north west] (box) at ([shift={(1cm,-1cm)}]current page.north west){%
\begin{minipage}{0.5\textwidth}
Hier werden die chemisch-physikalischen Eigenschaften gelistet sein.
\end{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {Physikalisch-chemische Eigenschaften};
\end{tikzpicture}
%
\tikzstyle{mybox} = [draw=blue, fill=green!20, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=blue, text=white, ellipse]
%
\begin{tikzpicture}[remember picture,overlay]
\node [mybox,anchor=north east] (box) at ([shift={(-1cm,-1cm)}]current page.north east){%
\begin{minipage}{0.5\textwidth}
Hier sollen die pharmakodynamischen Parameter stehen!
\end{minipage}
};
\node[fancytitle] at (box.north) {Pharmakodynamik};
\end{tikzpicture}\vspace{3cm}
%
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {
\chemfig{*6(=(-[:-90]OH)-=-(-[:90]N(-[:150]H)-[:30](=O)-[:-30]CH_3)=-)}};
\end{tikzpicture}
%\caption{Paracetamol}
%\end{figure}\vspace{3cm}
%
\tikzstyle{mybox} = [draw=black, fill=blue!20, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=black, text=white]
%
\begin{tikzpicture}[remember picture,overlay]
\node [mybox,anchor=south west] (box) at ([shift={(1cm,1cm)}]current page.south west){%
\begin{minipage}{0.5\textwidth}
Hier werden die chemisch-physikalischen Eigenschaften gelistet sein.
\end{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {Physikalisch-chemische Eigenschaften};
\end{tikzpicture}
%
\tikzstyle{mybox} = [draw=blue, fill=green!20, very thick,
rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=blue, text=white, ellipse]
%
\begin{tikzpicture}[remember picture,overlay]
\node [mybox,anchor=south east] (box) at ([shift={(-1cm,1cm)}]current page.south east){%
\begin{minipage}{0.5\textwidth}
Hier sollen die pharmakodynamischen Parameter stehen!
\end{minipage}
};
\node[fancytitle] at (box.north) {Pharmakodynamik};
\end{tikzpicture}
%
\end{document}
答案2
这里你可以找到一个非常简单的解决方案。
如果您需要页眉或页码,可以更改标题、宽度或页面大小。此外,您可以非常轻松地创建宏并反复使用它。如果您真的想要漂亮的框,您也可以轻松使用它们。
\documentclass{article}
\usepackage{chemfig}
\setdoublesep{0.357 em}
\setchemrel{0pt}{1.785 em}{2.785 em}
\setatomsep{1.785 em}
\setbondoffset{0.18265 em}
\setbondstyle{line width=0.0642}
\usepackage{blindtext}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,shadows,arrows}
\tikzstyle{mybox}=[rectangle, draw=black, rounded corners=1mm,text centered, text=black,rectangle split, rectangle split parts=2]
\makeatletter
\def\parsecomma#1,#2\endparsecomma{\def\page@x{#1}\def\page@y{#2}}
\tikzdeclarecoordinatesystem{page}{
\parsecomma#1\endparsecomma
\pgfpointanchor{current page}{north east}
% Save the upper right corner
\pgf@xc=\pgf@x%
\pgf@yc=\pgf@y%
% save the lower left corner
\pgfpointanchor{current page}{south west}
\pgf@xb=\pgf@x%
\pgf@yb=\pgf@y%
% Transform to the correct placement
\pgfmathparse{(\pgf@xc-\pgf@xb)/2.*\page@x+(\pgf@xc+\pgf@xb)/2.}
\expandafter\pgf@x\expandafter=\pgfmathresult pt
\pgfmathparse{(\pgf@yc-\pgf@yb)/2.*\page@y+(\pgf@yc+\pgf@yb)/2.}
\expandafter\pgf@y\expandafter=\pgfmathresult pt
}
\makeatother
\def\ltboxname{Physikalisch-chemische Eigenschaften}
\def\rtboxname{Pharmakodynamik}
\def\cboxname{Strukturformel}
\def\lbboxname{Pharmakodynamik}
\def\rbboxname{Physikalisch-chemische Eigenschaften}
\begin{document}
\newgeometry{inner=1cm,outer=1cm,top=2cm,bottom=2cm}
\begin{tikzpicture}[remember picture]
\node at (page cs:0.85,0.85) [mybox,anchor=north east] {
\textbf{\rtboxname}
\nodepart{second}
\begin{minipage}{0.42\textwidth}
\blindtext
\end{minipage}
};
\node at (page cs:-0.85,0.85) [mybox,anchor=north west] {
\textbf{\ltboxname}
\nodepart{second}
\begin{minipage}{0.42\textwidth}
\blindtext
\end{minipage}
};
\node at (page cs:-0.85,-0.85) [mybox,anchor=south west] {
\textbf{\lbboxname}
\nodepart{second}
\begin{minipage}{0.42\textwidth}
\blindtext
\end{minipage}
};
\node at (page cs:0.85,-0.85) [mybox,anchor=south east] {
\textbf{\rbboxname}
\nodepart{second}
\begin{minipage}{0.42\textwidth}
\blindtext
\end{minipage}
};
\node at (page cs:0,0) [anchor=center] {
\begin{minipage}{0.8\textwidth}
\centering
\chemname{\chemfig{*6((-OH)-=-(-\chemabove{N}{H}-[:-30](=[:-90]O)-[:30]CH_3)=-=)}}{Paracetamol}
\end{minipage}
};
\end{tikzpicture}
\restoregeometry
\end{document}