[Tex/LaTex] How to define a different style for edges and nodes

tikz-pgf

Given this image (a simple edge between two nodes):

\begin{tikzpicture}[>=latex,line join=bevel,]
  \node (a1) at (44bp,8bp) [draw,trapezium] {$A$};
  \node (d1) at (44bp,82bp) [draw,trapezium, shape border rotate=180] {$B$};
  \draw [->] (d1) ..controls (44bp,62.836bp) and (44bp,41.478bp)  .. node {$edge$} (a1);
\end{tikzpicture}

I defined:

\tikzstyle{every node}=[drop shadow, fill=white, draw]

What happends is that also the node on the edge gets rendered in a box and with shadow. I want the edge label to be just the text without loosing the every node rule.

Thus my question is: Is there a way I can specify specific rendering for nodes in edges while keeping all other nodes with shadow?

I must note that my tikz picture is generated, thus I only have control over the every styles.

Best Answer

You're not using an edge in the TikZ sense in your drawing, it's just a normal path with a node ( TikZ edge is created by using \path (A) edge (B)). As such, no every ... style that's specific to the "edge" node is installed, and you can't hook into it.

Since you say your image is generated (how?), you might have to approach this a bit differently. Instead of making every node have a drop shadow, you can apply the shadow just to every trapezium node in this example.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,shadows}
\begin{document}
\tikzset{every trapezium node/.style={
        drop shadow, fill=white, draw
    }
}
\begin{tikzpicture}[>=latex,line join=bevel,]
  \node (a1) at (44bp,8bp) [draw,trapezium] {$A$};
  \node (d1) at (44bp,82bp) [draw,trapezium, shape border rotate=180] {$B$};
  \draw [->] (d1) ..controls (44bp,62.836bp) and (44bp,41.478bp)  .. node {$edge$} (a1);
\end{tikzpicture}
\end{document}