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.

7
  • Could you please add what that symbol looks like.
    – Caramdir
    Aug 5, 2010 at 14:48
  • @Caramdir: take a look at my answer to see what it looks like. Aug 5, 2010 at 15:06
  • To clarify: do you want to know what the symbol is, or how to place it correctly in the diagram? (I must admit that I wouldn't regard this as a symbol in the same way that I wouldn't regard an arrow as a symbol.) Aug 5, 2010 at 15:29
  • 1
    @Caramdir: I didn't want to add the diagram until K.J.Moi had enough reputation to add a diagram as (from other experience) that might limit K.J.Moi's ability to edit the question. Aug 5, 2010 at 15:34
  • 1
    Sorry. How much reputation is needed to add a picture?
    – Caramdir
    Aug 5, 2010 at 15:37

5 Answers 5

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:

1
  • 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. Apr 29, 2011 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.)

5
  • I guess there are different ways of doing this but I'm used to seeing the "corner" you put in closer to the Z in the diagram and a dot placed in the middle of the "corner".
    – K.J. Moi
    Aug 5, 2010 at 15:24
  • @K.J. Moi: Right, I've added the dot and shifted it towards the Z. If it still isn't right, you'll have to give me an example! Aug 5, 2010 at 17:35
  • Andrew - +1 for the door opening instructions alone! Dec 14, 2010 at 6:26
  • @David: did you not see that when I first posted it? Dec 14, 2010 at 21:04
  • Little late to tell you so, but no. Jan 5, 2011 at 11:37
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.

1
  • 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, 2019 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

7
  • 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!). Aug 5, 2010 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 5, 2010 at 15:16
  • I guess that needs clarifying - I'll comment on the original question. Aug 5, 2010 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 5, 2010 at 16:04
  • There is a problem with using \rlap in math mode but <a href="math.arizona.edu/~aprl/publications/mathclap/…> 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 5, 2010 at 16:34
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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .