救命!为什么我的花括号显示为直线?

救命!为什么我的花括号显示为直线?

我是 Latex 的初学者,我一直在阅读所有关于花括号的资料。我设法将它放置在我想要的位置,但现在我的花括号显示为一条直线。当我在仅使用此图的新文件中编写代码时,花括号会显示,但只显示在另一个位置。我该怎么做才能修复它?谢谢!!

 \documentclass{beamer}
 \usetheme{Frankfurt}
 \setbeamercovered{transparent}
 \usepackage{pgf,tikz}
 \usetikzlibrary{positioning, arrows, automata}

 \begin{document}
    \scalebox{1.1}
    {
    \begin{tikzpicture}
    [node distance= 1cm,auto,
    every node/.style={text=white,rounded corners=0.05cm},
    grande/.style={rectangle,  fill=green!60!blue, font=\large, minimum width= 7cm, minimum height=0.8cm},
    peque/.style={rectangle, fill=green!30!black, font=\large, minimum width=3.5cm, minimum height= 0.4cm}]

    \node[grande, xshift=1.5cm]  (oracion){Oración};
    \node[grande, below of=oracion] (evento) {Evento};
    \node[grande, below of=evento] (EPA) {EPA};

    \node[peque, below of= EPA, anchor=east, minimum width=3.5cm](syntax){Sintaxis};
    \node[peque, right=0.03cm of syntax,minimum width=3.5cm](semantics){Semántica};
    \node[peque, below of=syntax, yshift=0.4cm](funciones){\scriptsize F. sintácticas};
    \node[peque, right=0.03cm of funciones, minimum width=1.73cm, yshift=0cm](roles){\tiny R. temáticos};
    \node[peque, right=0.03cm of roles, minimum width=1.73cm](rasgos){\tiny R. semánticos};

    \draw [decorate,decoration={brace,amplitude=10pt},xshift=-0.5cm,yshift=-5cm] (-2,1.0) -- (-2,2.5) node [black,midway,xshift=-0.6cm, yshift=0cm]  {\footnotesize Diátesis};

    \end{tikzpicture}}
\end{document}

答案1

您需要加载decorations.pathreplacing库才能使用装饰。

\documentclass{beamer}
\usetheme{Frankfurt}
 \setbeamercovered{transparent}
 \usepackage{pgf,tikz}
 \usetikzlibrary{positioning, arrows, automata, decorations.pathreplacing}

 \begin{document}
    \scalebox{1.1}
    {
    \begin{tikzpicture}
    [node distance= 1cm,auto,
    every node/.style={text=white,rounded corners=0.05cm},
    grande/.style={rectangle,  fill=green!60!blue, font=\large, minimum width= 7cm, minimum height=0.8cm},
    peque/.style={rectangle, fill=green!30!black, font=\large, minimum width=3.5cm, minimum height= 0.4cm}]

    \node[grande, xshift=1.5cm]  (oracion){Oración};
    \node[grande, below of=oracion] (evento) {Evento};
    \node[grande, below of=evento] (EPA) {EPA};

    \node[peque, below of= EPA, anchor=east, minimum width=3.5cm](syntax){Sintaxis};
    \node[peque, right=0.03cm of syntax,minimum width=3.5cm](semantics){Semántica};
    \node[peque, below of=syntax, yshift=0.4cm](funciones){\scriptsize F. sintácticas};
    \node[peque, right=0.03cm of funciones, minimum width=1.73cm, yshift=0cm](roles){\tiny R. temáticos};
    \node[peque, right=0.03cm of roles, minimum width=1.73cm](rasgos){\tiny R. semánticos};

    \draw [decorate,decoration={brace,amplitude=10pt},xshift=-0.5cm,yshift=-5cm] (-2,1.0) -- (-2,2.5) node [black,midway,xshift=-0.6cm, yshift=0cm]  {\footnotesize Diátesis};

    \end{tikzpicture}}
\end{document}

在此处输入图片描述

答案2

离题(因为你的主要问题已经解决了@JouleV答案),但它可能会有所帮助:

  • 图像包含在frame环境中(因为你使用beamer文档类
  • 用于定位节点的语法来自positioning
  • 仅使用相对坐标,
  • 节点位于两条链中
  • 在节点中只使用两种不同的字体大小,并且它们的定义被移到节点样式内
  • 用于calligraphic brace在包中定义的括号calligraphy

    \documentclass{beamer}
    \usetheme{Frankfurt}
    \setbeamercovered{transparent}
    \usepackage{tikz}
    \usetikzlibrary{arrows, automata,
                    calc, chains,
                    decorations.pathreplacing,
                    calligraphy,
                    positioning}
    
    \begin{document}
    \begin{frame}[fragile]
    \frametitle{My image}
        \begin{tikzpicture}[
         node distance = 2mm and 1mm,
           start chain = A going right,
           start chain = B going above,
           base/.style = {rounded corners=0.5mm, text=white},
         grande/.style = {base, fill=green!60!blue, font=\large,
                          minimum width=87mm, minimum height=8mm,
                          on chain=B},
     peque/.style args = {#1/#2}{base, fill=green!30!black,
                                 minimum width=#1, minimum height= 5mm,
                                 font=#2,
                                 on chain=A},
             BC/.style = {decorate,
                decoration={calligraphic brace, amplitude=5pt,
                pre =moveto, pre  length=1pt,
                post=moveto, post length=1pt,
                raise=5pt}, % for mirroring of brace
                very thick,
                pen colour=black},
                           ]
    \node[peque=43mm/\scriptsize]   (funciones) {F. sintácticas};
    \node[peque=21mm/\scriptsize]               {R. temáticos};
    \node[peque=21mm/\scriptsize]               {R. semánticos};
    \node[peque=43mm/\large,
          above=of funciones]       (syntax)    {Sintaxis};
    \node[peque=43mm/\large]        (semantics) {Semántica};
    \node[grande,
          above=of $(syntax.north)!0.5!(semantics.north)$]  {EPA};
    \node[grande]   {Evento};
    \node[grande]   {Oración};
    %
    \draw[BC]   (funciones.south west) --
              node[left=9pt,font=\footnotesize] {Diátesis}
                (syntax.north west);
        \end{tikzpicture}
    \end{frame}
    

在此处输入图片描述

相关内容