首頁>LaTeX>source

我正在使用Tikz建立良好的保證金說明,例如Gonzalo對

pgfplots
最新回復
  • 2019-12-5
    1 #

    我要定義一个 \caution*   哪个不適用阴影.這是使用 \caution的輸出   和 \caution*

    代碼:
    \documentclass{article}
    \usepackage[lmargin=5cm,textwidth=15cm,marginparwidth=4cm]{geometry}
    \usepackage[dvipsnames]{xcolor}
    \usepackage{ragged2e}
    \usepackage{xparse}
    \usepackage[framemethod=tikz]{mdframed}
    \usepackage{tikzpagenodes}
    \usetikzlibrary{calc}
    \usepackage{lipsum}
    \usetikzlibrary{shadows}
    \usepackage{pgfplots}
    \newcounter{mycaution}
    \newcommand\pointeranchor{}
    \newcommand\boxanchor{}
    \newlength\boxvshift
    \newlength\uppertrianglecorner
    \newcommand\tikzmark[1]{%
      \tikz[remember picture,overlay]\node[inner xsep=0pt,outer sep=0pt] (#1) {};}
    \NewDocumentCommand{\caution}{sO{c}O{BrickRed}O{Caution!}m}{%
        \stepcounter{mycaution}%
        \tikzmark{\themycaution}%
        \renewcommand\pointeranchor{mybox\themycaution.east}%
        \renewcommand\boxanchor{east}%
        \setlength\boxvshift{0pt}%
        \setlength\uppertrianglecorner{3pt}%
        \IfBooleanTF{#1}{%
            \tikzset{shadow options/.style={}}
        }{%
            \tikzset{shadow options/.style={drop shadow=#3!80!black!50!white}}
        }%
        \begin{tikzpicture}[remember picture,overlay]
        \node[draw=#3,anchor=\boxanchor,xshift=-\marginparsep,yshift=\boxvshift,shadow options,fill=white]   
          (mybox\themycaution)
          at ([yshift=3pt]current page text area.west|-\themycaution) 
          {\parbox{\marginparwidth}{\vskip10pt\RaggedRight\small#5}};
        \node[fill=white,font=\color{#3}\sffamily,anchor=west,xshift=7pt]
          at (mybox\themycaution.north west) {\ #4\ };
        \end{tikzpicture}%
    }
    \newcommand\Test{Nulla malesuada porttitor diam. Donec felis erat, congue non, volutpat at, tincidunt tristique, libero. Vivamus viverra fermentum felis. Donec nonummy pellentesque ante. Phasellus adipiscing
    semper elit.}
    \newcommand{\CautionTikz}{%
        \begin{tikzpicture}[]
        \begin{axis}[xmin=-1,xmax=2,ymin=0.4,ymax=1.5,width=\marginparwidth,axis lines=middle,xtick=1,xticklabels=$a$,ytick=\empty]
        \addplot[red,mark=none,domain=-1:1]{1};
        \addplot[red,mark=none,domain=1:2]{x-0.5};
        \end{axis}
        \end{tikzpicture}%
    }%
    \begin{document}
    \lipsum*[3]%
    \caution[t]{\CautionTikz}%
    \par
    \lipsum*[3]%
    \caution*[t]{\CautionTikz}%
    \lipsum[3]
    \end{document}
    

  • 數學和數字標準技術文章的最佳實践(包)
  • LaTeX itemize:如何在專案中縮排新段落?