15

How do I typeset that little symbol which indicates that a commutative square is a pushout or pullback square? I usually draw my diagrams in XY-pic, so I'd be most interested in how to do it there.

Added: The desired effect is a diagram like

pullback

Edit: The problem is in typesetting the actual symbol, the XY-pic user's guide says how to place it.

diabonas
  • 25,784
K.J. Moi
  • 251

5 Answers5

18

Put these guys in your preamble:

\newcommand{\po}{\ar@{}[dr]|{\text{\pigpenfont R}}}
\newcommand{\pb}{\ar@{}[dr]|{\text{\pigpenfont J}}}

This uses the package pigpen for the symbols in the middle. The \ar@{} specifies an invisible arrow, and |{-} smacks some text in the middle of it. Whenever you want a pushout (or pullback) you put \po (or \pb) in the upper left of your square. Here is some sample code:

\xymatrix{X\ar[r]\ar[d]_{i_0}\po &\ast\ar[d]\\
    X\times I\ar[r]&CX}

and here is the picture:

Werner
  • 603,163
  • 1
    Good answer. I think you should say that these commands should be in the preamble instead of header, though. Header sounds more like the top of a page. – Matthew Leingang Apr 29 '11 at 16:33
11

I'm posting this more so that people know what K.J. Moi is talking about! Here's how to do it in TikZ:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}

\begin{tikzpicture}[>=latex]
\node (w) at (0,0) {\(W\)};
\node (x) at (0,-2) {\(X\)};
\node (y) at (2,0) {\(Y\)};
\node (z) at (2,-2) {\(Z\)};
\draw[->] (w) -- (y);
\draw[->] (w) -- (x);
\draw[->] (x) -- (z);
\draw[->] (y) -- (z);
\begin{scope}[shift=($(w)!.5!(z)$)]
\draw +(-.5,0) -- +(0,0)  -- +(0,.5);
\fill +(-.25,.25) circle (.05);
\end{scope}
\end{tikzpicture}
\end{document}

And here's the output:

pullback

(pdf, and this is not to be confused with these instructions for opening a door)

So strictly speaking, it's not a symbol itself but a couple of lines set into the diagram. I don't know how to do this in XY as I'm a die-hard practitioner of TikZ, but hopefully seeing the picture will help others figure it out for you!

(Note that there are probably slicker ways of doing it in TikZ as well, I was going for speed here as I guessed not everyone would know what a pullback diagram is!)

(Edited to add the dot and to shift the symbol a bit closer towards the Z; I'm not sure exactly how far it should be shifted, but the .5 in the expression ($(w)!.5!(z)$) controls how far between the W and Z the point of the symbol lies; bigger numbers shift it to towards Z.)

diabonas
  • 25,784
Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751
11

The following solution is from the tikzcd documentation, Version 0.9e October 30, 2014:

\begin{tikzcd}
    A \arrow[r] \arrow[d]
    \arrow[dr, phantom, "\ulcorner", very near start]
    & B \arrow[d] \\
    C \arrow[r]
    & D
\end{tikzcd}

Image showing the rendered LaTeX output, a commutative square A, B, C, D with an \ulcorner at the top left.

You can change the corner to \lrcorner.

ComFreek
  • 1,248
  • 2
  • 15
  • 22
Yan King Yin
  • 1,743
  • 1
  • 19
  • 26
  • I had success visualizing a pushout with \begin{tikzcd} A \arrow[r] \arrow[d] & B \arrow[d] \\ C \arrow[r] & D \arrow[ul, phantom, "\ulcorner", very near start] \end{tikzcd} – ComFreek Mar 26 '19 at 13:32
6

Use the Comprehensive LaTeX Symbol List to find it or use the Detexify tool.

You may use the symbols \lrcorner, \ulcorner, \llcorner or \urcorner of the amssymb package.

A dot might be put into the corner for instance by $\rlap{$\cdot$}\lrcorner$. Or use \mathrlap as suggested in the comments.

Here's a possible definition for that symbol:

\newcommand*{\corner}{\mbox{\LARGE{$\mathrlap{\cdot}\lrcorner$}}}

Insert small spacing if you would like to adjust the position of the dot within the corner symbol.

Here's a complete minimal example producing a complete matrix:

\documentclass{article}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{xypic}
\newcommand*{\corner}{\mbox{\LARGE{$\mathrlap{\cdot}\lrcorner$}}}
\begin{document}
\xymatrix{%
  \ar @{} [dr] | \corner A \ar[r] \ar[d] &B \ar[d] \\
  C \ar[r] & D
}
\end{document}

alt text

Werner
  • 603,163
Stefan Kottwitz
  • 231,401
  • I suspect that the problem is less in defining the symbol itself as to placing it in the correct place in the diagram. See my answer for what it should look like (but my answer uses TikZ and the questioner asked for xy so the question itself is still open!). – Andrew Stacey Aug 05 '10 at 15:07
  • I understood it as how to typeset the symbol, not how to place it. Though xy commands would be able to place it somewhere. I added symbols of amssymb. – Stefan Kottwitz Aug 05 '10 at 15:16
  • I guess that needs clarifying - I'll comment on the original question. – Andrew Stacey Aug 05 '10 at 15:28
  • Those corner commands look good. There is still the problem of placing the dot in the middle. On page 98 of the comprehensive symbol list the symbol {\pigpenfont J} is pretty much what I want. I've seen this symbol used a lot, so I'd be surprised if there isn't some easier way. – K.J. Moi Aug 05 '10 at 16:04
  • There is a problem with using \rlap in math mode but here is a way around it. Using the new macros on p.4 the code \xymatrix{\ar @{} [dr] |{\text{\LARGE{$\mathrlap{\cdot}\lrcorner$}}} A \ar[r] \ar[d] &B \ar[d] \C \ar[r] & D} gives decent output. The input however is far from decent, so I really hope someone knows of a better way. – K.J. Moi Aug 05 '10 at 16:34
  • Define a small macro for \text{\LARGE{$\mathrlap{\cdot}\lrcorner$}} to clear the input. – Stefan Kottwitz Aug 05 '10 at 16:46
  • for \rlap in math mode, use \mathrlap from the mathtools package. – Caramdir Aug 05 '10 at 18:22
0

Here is a solution using pic of TikZ.

enter image description here

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}[>=latex,bmrd/.pic={
\draw (2mm,0)--++(-90:2mm)--++(180:2mm);
\fill (1mm,-1mm) circle(1pt);
}]
\def\a{1.5}
\path
(0,0)        node (W) {$W$}
+(-45:.5*\a) pic[scale=1.2,red]{bmrd}
+(0:\a)      node (Y) {$Y$}
++(-90:\a)   node (X) {$X$}
+(0:\a)      node (Z) {$Z$};
\draw[->] (W)--(Y);
\draw[->] (W)--(X);
\draw[->] (X)--(Z);
\draw[->] (Y)--(Z);
\end{tikzpicture}
\end{document}
Black Mild
  • 17,569