改进代码 - 透视和旋转中的公式

改进代码 - 透视和旋转中的公式

我想重现下一个图像或改进它,使其具有深度和像星星一样的小点的效果。

\documentclass{standalone}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\clip(-10pt,-10pt) rectangle (610pt,310pt);

\fill[black!95!white] (0,0) rectangle (600pt,300pt);

\node[rotate=45,white] at (80pt,50pt)  {$ \vec{F}=m\vec{a} $};
\node[rotate=-45,white] at (550pt,50pt)  {$ e=m c^2 $};

\node[rotate=45,white] at (50pt,100pt)  {$ \vec{F}=m \frac{d \vec{v}}{dt} + \vec{v}\frac{dm}{dt} $};
\node[rotate=-45,white] at (520pt,100pt)  {$  \vec{F}_g=-F\frac{m_1 m_2}{r^2} \vec{e}_r $};

\node[rotate=45,white] at (70pt,150pt)  {$ \lim_{x \to a} \frac{f(x) - f(a)}{x - a} $};
\node[rotate=-45,white] at (550pt,150pt)  {$ \int_{0}^{\pi} \sin x \, dx = 2 $};

\node[rotate=10,white] at (100pt,250pt)  {$ \frac{d}{dx}\sin x=\cos x $};
\node[rotate=-10,white] at (500pt,250pt)  {$ \frac{d}{dx}\ln(x)=\frac{1}{x} $};

\node[rotate=60,white] at (200pt,150pt)  {$ x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + a_4}}} $};
\node[rotate=15,white] at (350pt,100pt)  {$ \mathbf{X} = \left(
    \begin{array}{ccc}
    x_1 & x_2 & \ldots \\
    x_3 & x_4 & \ldots \\
    \vdots & \vdots & \ddots
    \end{array} \right) $};
\node[rotate=20,white] at (400pt,250pt)  {$  2H_2 + O_2 {\overset{n,m}{\longrightarrow}} 2H_2O $};

\end{tikzpicture}   

\end{document}

enter image description here

它看起来应该与这张图片相似。

enter image description here

答案1

在这里使用我的答案:将文本放置在 3D 立方体的表面上

在这种情况下,我使用等距视图(不是透视图)轴在 +/-30 度,垂直方向为 90 度。但是,如果每个公式相对于整体场来说足够小,那么您可能能够调整每个公式,使其完全等距,整体感知(几乎)处于透视状态。

\documentclass{standalone}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{tikz}
\usepackage{graphicx,amssymb,fp}
\newsavebox\foobox
\newcommand\slbox[2]{%
  \FPdiv{\result}{#1}{57.296}% CONVERT deg TO rad
  \FPtan{\result}{\result}%
  \slantbox[\result]{#2}%
}%
\newcommand{\slantbox}[2][30]{%
        \mbox{%
        \sbox{\foobox}{#2}%
        \hskip\wd\foobox
        \pdfsave
        \pdfsetmatrix{1 0 #1 1}%
        \llap{\usebox{\foobox}}%
        \pdfrestore
}}
\newcommand\rotslant[3]{\rotatebox{#1}{\textcolor{white}{\slbox{#2}{#3}}}}
\begin{document}

\begin{tikzpicture}
\clip(-10pt,-10pt) rectangle (610pt,310pt);

\fill[black!95!white] (0,0) rectangle (600pt,300pt);

\node at (80pt,50pt)  {\rotslant{30}{30}{$ \vec{F}=m\vec{a}$}};
\node at (550pt,50pt)  {\rotslant{-30}{30}{$ e=m c^2 $}};

\node at (50pt,100pt)  {\rotslant{30}{30}{$ \vec{F}=m \frac{d \vec{v}}{dt} + \vec{v}\frac{dm}{dt} $}};
\node at (520pt,100pt)  {\rotslant{-30}{-30}{$\vec{F}_g=-F\frac{m_1 m_2}{r^2} \vec{e}_r $}};

\node at (70pt,150pt)  {\rotslant{30}{-30}{$ \lim_{x \to a} \frac{f(x) - f(a)}{x - a} $}};
\node at (550pt,150pt)  {\rotslant{-30}{-30}{$ \int_{0}^{\pi} \sin x \, dx = 2 $}};

\node at (100pt,250pt)  {\rotslant{30}{-30}{$ \frac{d}{dx}\sin x=\cos x $}};
\node at (500pt,250pt)  {\rotslant{-30}{-30}{$ \frac{d}{dx}\ln(x)=\frac{1}{x} $}};

\node at (200pt,150pt)  {\rotslant{30}{30}{$ x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + a_4}}} $}};
\node at (350pt,100pt)  {\rotslant{-30}{30}{$ \mathbf{X} = \left(
    \begin{array}{ccc}
    x_1 & x_2 & \ldots \\
    x_3 & x_4 & \ldots \\
    \vdots & \vdots & \ddots
    \end{array} \right) $}};
\node at (400pt,250pt)  {\rotslant{-30}{-30}{$  2H_2 + O_2 {\overset{n,m}{\longrightarrow}} 2H_2O $}};

\end{tikzpicture}   

\end{document}

enter image description here

这是我所指的假视角,通过手动设置各个方程的旋转:

\documentclass{standalone}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{tikz}
\usepackage{graphicx,amssymb,fp}
\newsavebox\foobox
\newcommand\slbox[2]{%
  \FPdiv{\result}{#1}{57.296}% CONVERT deg TO rad
  \FPtan{\result}{\result}%
  \slantbox[\result]{#2}%
}%
\newcommand{\slantbox}[2][30]{%
        \mbox{%
        \sbox{\foobox}{#2}%
        \hskip\wd\foobox
        \pdfsave
        \pdfsetmatrix{1 0 #1 1}%
        \llap{\usebox{\foobox}}%
        \pdfrestore
}}
\newcommand\rotslant[3]{\rotatebox{#1}{\textcolor{white}{\slbox{#2}{#3}}}}
\begin{document}
\begin{tikzpicture}
\clip(-10pt,-10pt) rectangle (610pt,310pt);

\fill[black!95!white] (0,0) rectangle (600pt,300pt);

\node at (80pt,50pt)  {\rotslant{43}{43}{
  $ \vec{F}=m\vec{a}$}};
\node at (550pt,50pt)  {\rotslant{-35}{35}{
  $ e=m c^2 $}};
\node at (50pt,100pt)  {\rotslant{38}{38}{
  $ \vec{F}=m \frac{d \vec{v}}{dt} + \vec{v}\frac{dm}{dt} $}};
\node at (520pt,100pt)  {\rotslant{-40}{-40}{
  $\vec{F}_g=-F\frac{m_1 m_2}{r^2} \vec{e}_r $}};
\node at (70pt,150pt)  {\rotslant{32}{-32}{
  $ \lim_{x \to a} \frac{f(x) - f(a)}{x - a} $}};
\node at (550pt,150pt)  {\rotslant{-32}{-32}{
  $ \int_{0}^{\pi} \sin x \, dx = 2 $}};
\node at (100pt,250pt)  {\rotslant{20}{-20}{
  $ \frac{d}{dx}\sin x=\cos x $}};
\node at (500pt,250pt)  {\rotslant{-25}{-25}{
  $ \frac{d}{dx}\ln(x)=\frac{1}{x} $}};

\node at (200pt,150pt)  {\rotslant{42}{42}{
  $ x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + a_4}}} $}};
\node at (380pt,100pt)  {\rotslant{-39}{39}{
  $ \mathbf{X} = \left(
    \begin{array}{ccc}
    x_1 & x_2 & \ldots \\
    x_3 & x_4 & \ldots \\
    \vdots & \vdots & \ddots
    \end{array} \right) $}};
\node at (400pt,250pt)  {\rotslant{-30}{-30}{
  $  2H_2 + O_2 {\overset{n,m}{\longrightarrow}} 2H_2O $}};
\end{tikzpicture}   
\end{document}

enter image description here

答案2

这不是一个太严肃的答案,而只是为了证实我的说法,即使用渐近线可以非常轻松地完成此类事情。(您需要运行例如pdflatex -shell-escape。)

\documentclass[border=3.14mm]{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=AsyPers}
import labelpath3;
size(8cm,8cm);
settings.render = 4;
currentprojection = perspective((-0.5,4,0.1), up=Z,autoadjust=true);
currentlight=(2,15,5);
material pens =  material(diffusepen=0.7blue,ambientpen=blue,emissivepen=0.9*white,specularpen=0.95white,shininess=0.95);
draw(scale(0.8,1,-1)*labelpath("$\displaystyle B(p,q)=\frac{\Gamma(p)\,\Gamma(q)}{\Gamma(p+q)}$",
(2*Y+X-Z) -- X-Z),pens);
path3 Back=scale3(3)*plane(X,Z,O);
draw(surface(Back), black);
\end{asypicture}
\end{document}

enter image description here

在我忘记之前:当然还有专门的 TiZ 包和库来进行投影。

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{amsmath,amsfonts,amssymb,mathtools}
\usetikzlibrary{3d}
\usepackage{tikz-3dplot}
\makeatletter % https://tex.stackexchange.com/a/48776/121799
\tikzoption{canvas is xy plane at z}[]{%
  \def\tikz@plane@origin{\pgfpointxyz{0}{0}{#1}}%
  \def\tikz@plane@x{\pgfpointxyz{1}{0}{#1}}%
  \def\tikz@plane@y{\pgfpointxyz{0}{1}{#1}}%
  \tikz@canvas@is@plane
}
\makeatother
\newcommand{\dd}{\ensuremath{\mathrm{d}}}
\begin{document}

\begin{tikzpicture}
%\clip(-10pt,-10pt) rectangle (610pt,310pt);

\fill[black!95!white] (0,0) rectangle (600pt,300pt);
%\tdplotsetmaincoords{90+30*sin(\X)}{\X}
\tdplotsetmaincoords{90+30*sin(40)}{40}
\begin{scope}[tdplot_main_coords,white,transform shape]
 \begin{scope}[canvas is xy plane at z=0,yscale=-1]
  \node at (80pt,5pt)  {$ \vec{F}=m\,\vec{a} $};
  \node at (50pt,10pt)  {$ \vec{F}=m \frac{\dd \vec{v}}{\dd t} 
  + \vec{v}\frac{\dd m}{\dd t} $};
  \node at (270pt,15pt)  {$\displaystyle \lim_{x \to a} \frac{f(x) - f(a)}{x - a} $};
 \end{scope}
 \begin{scope}[canvas is xy plane at z=0]
  \node at (550pt,50pt)  {$ E=m\, c^2 $};
  \node at (520pt,100pt)  {$  \vec{F}_g=-F\,\frac{m_1 m_2}{r^2}\, \vec{e}_r $};
  \node at (550pt,150pt)  {$\displaystyle \int\limits_{0}^{\pi} \sin x \, \dd x = 2 $};
 \end{scope}
 \begin{scope}[canvas is xz plane at y=0]
  \node at (100pt,250pt)  {$\displaystyle \frac{\dd}{\dd x}\sin x=\cos x $};
  \node at (500pt,50pt)  {$\displaystyle \frac{\dd }{\dd x}\ln(x)=\frac{1}{x} $};
  \node at (400pt,50pt)  {$  2\text{H}_2 + \text{O}_2 \xrightarrow{n,m}
  2\text{H}_2\text{O} $};
 \end{scope} 
 \begin{scope}[canvas is yz plane at x=0]
  \node at (200pt,150pt)  {$\displaystyle x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + a_4}}} $};
  \node at (350pt,300pt)  {$ \mathbf{X} = 
    \begin{pmatrix}
    x_1 & x_2 & \ldots \\
    x_3 & x_4 & \ldots \\
    \vdots & \vdots & \ddots
    \end{pmatrix}$};
 \end{scope}
\end{scope}
\end{tikzpicture}   
\end{document}

enter image description here

正如您所见,我没有花任何功夫去将它们排列好(但我做了一些调整,例如切换到pmatrix、使用\overrightarrow和使化学元素和微分 d 等符号直立)。

相关内容