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.

How does one get inline or at least formula space typography of the following sort in an easy to parse (for the editor) way when writing formulas, for instance:

IMG1

Yes, I know, the equalities ... can be done within TikZ for commuting diagrams, like with arrows. But is there an easy way to just to use vertical equalities (and most importantly, inequalities) in this way in simple formulas, without invoking a TikZ frame, in ordinary latex math $ ... $.

EDIT:

I should just clarify, I meant the above image as an example. Some great solutions were posted, but how can they be generalized to allow for more or fewer levels or nested together, so that they can be robustly used without changing the basic grid above below to left to right relative framework (and thus avoiding driving the editor of a paper or coauthor mad)? For instance, also:

IMG2

IMG3

Most clearly: how can stacks or macros be used to create in line or in formula "above" "below" arbitrary equalities/inequalities that ignore other levels above and below?

My own attempt, which doesn't quite work, since columns cannot overlap sideways in matrices, and yet they have to look good, and the same problem with the macro approach, and of course a matrix cannot be subscript size:

IMG4

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsmath}
\usepackage{adjustbox}

\newcommand{\veq}{\mathrel{\rotatebox{90}{$=$}}}
\newcommand{\vneq}{\mathrel{\rotatebox{90}{$\neq$}}}

\begin{document}

This is a test. Yes it is. Of course. Look here. Yes, Here. That's right. Mhmm. Words. Filler. Indeed. Look. A paragraph. With words. Here. Yes. And where's that? Where is here? It's right here:

\[ 
\left. \frac{\partial f(A,B,C,D)}{\partial A} \right|
\raisebox{.9\baselineskip}{$_{\begin{array}{ccccc}
A & = & B & = & Z \\
{} & {} & \vneq & {} & {} \\
C & \neq & I & \neq & W \\
\veq & {} & {} & {} & {} \\
D & = & G & \neq & Q^2+3 \end{array} }$}
\]

\end{document}
share|improve this question
    
I am working with matrices right now, too, too see if a robust solution is possible, but matrices make it unwieldy, the posted solutions are better if they can be made robust. –  Guido Jorg May 14 at 23:23

2 Answers 2

up vote 3 down vote accepted

Relatively straightforward with stacks. In essence, the vertical equality is the \tabbedCenterstack, using rotated equality signs \req and \rne.

For the first example, I just used a conventional stack, though for the more complex examples, a full tabular stack makes it easiest.

\documentclass{article}
\usepackage{tabstackengine}
\stackMath
\makeatletter
\renewcommand\TAB@delim[1]{\scriptstyle#1}
\def\req{\protect\rotatebox{90}{$\scriptstyle=$}}
\def\rne{\protect\rotatebox{90}{$\scriptstyle\ne$}}
\makeatother
\usepackage{graphicx}
\begin{document}
\[
\setstackgap{L}{.6\baselineskip}
\left.\frac{\partial f(A,B,C,D)}{\partial A}\right|
\raisebox{.9\baselineskip}{$_{A = \tabbedCenterstack{C\\ \req\\0\\ \rne\\ D} \ne B}$}
\]

\[
\setstackgap{L}{.6\baselineskip}\setstacktabulargap{0pt}\TABbinary
\left.\frac{\partial f(A,B,C,D)}{\partial A}\right|
\raisebox{-.2\baselineskip}%
{$_{\tabularCenterstack{rcl}{A = & 0&\\ &\req&\\&D& \ne B = C}}$}
\]

\[
\setstackgap{L}{.6\baselineskip}\setstacktabulargap{0pt}\TABbinary
\left.\frac{\partial f(A,B,C,D)}{\partial A}\right|
\raisebox{.9\baselineskip}%
{$_{\tabularCenterstack{rcl}{L = & 0&\\ &\req&\\A = &0& \ne B = F\\
  &\rne&\\ &D&\ne B\\&\rne&\\&E&}}$}
\]
\end{document}

enter image description here

Note: the \TABbinary is not needed in \scriptstyle, but would be needed in \displaystyle, to place the proper spacing around the relational operators that appear immediately after a &.

share|improve this answer
    
Thank you for introducing the package. Trying out various things now. But how do I install the tabstackengine package permanently ? I have the .sty file but where must I place it if I permanently install it? Right now I just put in a folder with the tex file. –  Guido Jorg May 14 at 22:19
    
Also, is there a way to expand the macro for more/fewer levels up and horizontally, to make this a more robust solution? I'll clarify the first post with a better picture, since I meant this one as a general example. –  Guido Jorg May 14 at 22:38
    
@GuidoJorg As to your question about installation, each version of LaTeX stores local downloads in a different directory, which you would need to know to install permanently. For MikTeX, for example, that directory, by default, is C:\Users\(Your-username)\AppData\Roaming\MiKTeX\2.9\tex\latex. After locating the new files in such a directory, then (in the case of MikTeX), the filename database (FNDB) must be updated. At that point it is ready for use. I will now tackle your 2nd question. –  Steven B. Segletes May 14 at 23:37
1  
@GuidoJorg Please see revision. –  Steven B. Segletes May 14 at 23:52
    
Very nice! Will be working with this. –  Guido Jorg May 15 at 2:14

You can define a custom macro to do this for you:

enter image description here

The \mathclap was added to ensure that cases of wide text is handled properly:

enter image description here

References:

Code:

\documentclass{article}
\usepackage{graphicx}
\usepackage{mathtools}
\usepackage{adjustbox}

\newcommand{\veq}{\mathrel{\rotatebox{90}{$=$}}}
\newcommand{\vneq}{\mathrel{\rotatebox{90}{$\neq$}}}
\newcommand*{\VerticalRelations}[5]{%
    % #1 = center
    % #2 = above
    % #3 = symbol above
    % #4 = below
    % #5 = symbol below
    \adjustbox{stack=cc}{%
        \ensuremath{#2}\\%
        \ensuremath{\mathclap{#3}}\\%
        \ensuremath{#1}\\%
        \ensuremath{#5}\\%
        \ensuremath{\mathclap{#4}}%
    }%
}%
\begin{document}
\[
    A = \VerticalRelations{0}{C}{\veq}{D}{\vneq} \neq B
\]
and check appropriate spacing for longer ``above" and ``below" text:
\[
 A = \VerticalRelations{0}{C}{\veq}{D\neq B}{\vneq} \neq B
 \]
\end{document}
share|improve this answer
    
How do I avoid the centering of the lines when I replace let's say D with D not equals B, like in: [ A = \VerticalRelations{0}{C}{\veq}{D\neq B}{\vneq} \neq B ] ? Also, is there a way to expand the macro for more/fewer levels up and horizontally, to make this a more robust solution? –  Guido Jorg May 14 at 22:36
1  
@GuidoJorg: Had updated solution to ensure that that case is properly handled. –  Peter Grill May 15 at 6:54
    
very nice! will work a bit with the macro, too, though the first answer seems to be more robust, this is one of those cases were I'd like to give an acceptance to both answers. **** Is there a way to make the D shifted underneath the vneq and the below the other B? \hspace doesn't really work. (I'll work with this some more, maybe post a separate question about it, or add a comment here how to do it, if I figure it out.) –  Guido Jorg May 15 at 12:35
    
The \mathclap{} command is very useful in general I have to say –  Guido Jorg May 15 at 12:45

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.