Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I was wondering if there is a way to change, case's symbol(curly brace) to two arrows pointing up/left and down/left.

\documentclass[a4paper,11pt]{article}
\usepackage{kerkis}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{wasysym}
\usepackage{amsthm}
\usepackage{tikz}
\begin{document}
\begin{align}
\mathbf{\nabla}\times \mathbf{E}=&0\;\begin{cases}\mathbf{E}=-\mathbf{\nabla}\Phi \\     \hat{\eta}\times (\mathbf{E_2}-\mathbf{E_1})=0\mbox{(continiuty)}\end{cases}\\
1+1=&2
\end{align}
%TikZ code "illustrating" the new "brace"
\begin{tikzpicture}
\draw[->] (0,0) -- (1,1);
\draw[->] (0,0) -- (1,-1);
\end{tikzpicture}
\end{document}

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

Firstly here is a multiarrowed version:

Sample output

\documentclass[a4paper,11pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{tikz}
\usetikzlibrary{calc}

\tikzset{arrowcases/.style={matrix anchor=west,%
  nodes={anchor=base west,%
         name=arrc-\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn},%
  execute at begin cell=\node\bgroup\math\displaystyle,%
  execute at end cell=\endmath\egroup;,%
  ampersand replacement=\&}}

\def\beginarrowcases#1\endarrowcases{
\begin{tikzpicture}[baseline=(O)]
  \matrix [arrowcases] {
  #1
  };
  \coordinate (A) at (arrc-1-1.west);
  \coordinate (B) at (arrc-\the\pgfmatrixcurrentrow-1.west);
  \coordinate (start) at ($(A)!0.5!(B) - (1em,0)$);
  \foreach \nn in {1,...,\pgfmatrixcurrentrow} {
    \draw[->] (start) -- (arrc-\nn-1.west);
  };
  \coordinate (O) at ($(start)-(0,0.5ex)$);
  \node at (-1em,0) {};
\end{tikzpicture}}

\begin{document}


\begin{align}
  \mathbf{\nabla}\times \mathbf{E}&=0
  \beginarrowcases
    \mathbf{E}=-\mathbf{\nabla}\Phi \\
    \hat{\eta}\times (\mathbf{E_2}-\mathbf{E_1})=0 \&
    \text{(continuity)} \\
    \mathbf{E}=-\mathbf{\nabla}\Phi \& \text{(again)}\\
  \endarrowcases \\
  1+1 &= 2
\end{align}

\end{document}

This is obtained by making a matrix of math nodes like construction in tikz to build a cases like setup and then drawing the arrows. The syntax requires \& instead of & and \\ at the end of each line, because of the way the matrix construction is set-up in tikz and becuase of interaction with the amsmath package.

Secondly, here is how one replaces the cases bracket with another delimiter directly in the cases environment:

Sample cases output

\documentclass[a4paper,11pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{tikz}

\makeatletter
\renewenvironment{cases}[1][\lbrace]{%
  \matrix@check\cases\env@cases{#1}
}{%
  \endarray\right.%
}

\def\env@cases#1{%
  \let\@ifnextchar\new@ifnextchar
  \left#1
  \def\arraystretch{1.2}%
  \array{@{}l@{\quad}l@{}}%
}
\makeatother

\begin{document}
\begin{align}
  \mathbf{\nabla}\times \mathbf{E}&=0
  \begin{cases}
    \mathbf{E}=-\mathbf{\nabla}\Phi \\
    \hat{\eta}\times (\mathbf{E_2}-\mathbf{E_1})=0
    &\text{(continiuty)}
  \end{cases}
  \\
  1+1&=2\\
  \mathbf{\nabla}\times \mathbf{E}&=0
  \begin{cases}[\langle]
    \mathbf{E}=-\mathbf{\nabla}\Phi \\
    \hat{\eta}\times (\mathbf{E_2}-\mathbf{E_1})=0
    &\text{(continiuty)}
  \end{cases}
\end{align}

\end{document}

This acheived by redefining the cases environment to take an optional argument and putting that in the code at the place where \lbrace was hard coded.

Using a tikz picture for such a brace in this version is problematic. For a start one needs a construction that can be resized via \left. Furthermore in your request, you have arrows pointing to each row and that is hard to control. Hence, the multiarrowed code above is probably more what you want.

share|improve this answer
    
Yes!!!It's working? Thank you very much for your help! –  Thanos Jan 4 '13 at 14:06
add comment

A possible way with TikZ:

\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}

%TikZ code "illustrating" the new "brace"
\newcommand{\newbrace}[1][]{
\begin{tikzpicture}[baseline=-0.5ex]
\draw[#1] (0,0) -- (0.3,0.3);
\draw[#1] (0,0) -- (0.3,-0.3);
\end{tikzpicture}
}

% the optional argument allows you to select the type of arrow 
% you can also customize the "new brace"
\newenvironment{casesnew}[1][->]%
{\;\newbrace[#1]\;\begin{array}{@{}l@{}}}%
{\end{array}}


\begin{document}
\begin{align}
\mathbf{\nabla}\times \mathbf{E}=&\; 0
\begin{casesnew}
\mathbf{E}=-\mathbf{\nabla}\Phi \\
\hat{\eta}\times (\mathbf{E_2}-\mathbf{E_1})=0 \; \text{(continuity)}
\end{casesnew}\\
1+1=&\;2
\end{align}

Example with customization:
\begin{align}
\mathbf{\nabla}\times \mathbf{E}=&\;0
\begin{casesnew}[-stealth,red]
\mathbf{E}=-\mathbf{\nabla}\Phi \\
\hat{\eta}\times (\mathbf{E_2}-\mathbf{E_1})=0 \; \text{(continuity)}
\end{casesnew}\\
1+1=&\;2
\end{align}
\end{document}

The result:

enter image description here

Disclaimer

The solution works only for two cases.

share|improve this answer
    
There should be more space between the equality operators on the left and the following digits. –  Marc van Dongen Jan 4 '13 at 10:07
    
@MarcvanDongen: oh, that's right. I'll edit the answer, thanks :) –  Claudio Fiandrino Jan 4 '13 at 10:09
    
The align environment was intended to alignwithout user-intervention. You should write: ...\mathbf{E}&=0 not ...\mathbf{E}=&\;0. –  Marc van Dongen Jan 4 '13 at 10:50
    
@ClaudioFiandrino: Nice!!! Is there a way to do it for more that two cases? Actually to be able to automatically pick the right amount of arrows? –  Thanos Jan 4 '13 at 11:01
    
@MarcvanDongen: Thank's for the advice! I'll change it to see the difference! –  Thanos Jan 4 '13 at 11:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.