5

I need to plot the following hasse diagrams: 1) enter image description here

2)enter image description here

I tried using xypic. For the first I worte the following code

\xymatrix{
  &{G}\ar@{-}[dr]\ar@{-}[dl] \\
  {\mathbb{Z}_p}\ar@{-}[dr] & & \mathbb{Z}_q}\ar@{-}[dl]}\\
  {{e}} \\
}

but it displays nothing. About second one, I don't really know from where to start. I can write also this wrong code:

\xymatrix{
  & {HK}\ar@{-}[dr]\ar@{=}[dl]\\
  H@\ar{=}[dr] & K@\ar{-}[dl]\\
  {H\cap K}
}

How can I plot them both? Where is my mistake?

Moriambar
  • 11,466

2 Answers2

7

If you're not bound to use xy, I'd suugest you to use the powerful and more modern tikz-cd package instead:

\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[column sep=0.3cm]
{} & G\arrow[dash]{dr}\arrow[dash]{dl}
 & \\
\mathbb{Z}_p\arrow[dash]{dr} & & \mathbb{Z}_q\arrow[dash]{dl} \\
& \lbrace e\rbrace
\end{tikzcd}

\begin{tikzcd}[column sep=0.3cm]
{} & HK\arrow[equal]{dr}\arrow[dash]{dl}
 & \\
H\arrow[equal]{dr} & & K\arrow[dash]{dl} \\
& H\cap K
\end{tikzcd}

\end{document}

enter image description here

Moriambar
  • 11,466
Gonzalo Medina
  • 505,128
  • when I put the first in math-field in lyx it seems as a code and not as a diagram... – Danis Fischer Aug 26 '13 at 16:08
  • @CoarguAliquis you need to load the package, and then to introduce the diagrams using my code as LaTeX code. I am not familiar with LyX, but it must be pretty much the same you were doing with your xy diagrams. – Gonzalo Medina Aug 26 '13 at 16:12
6

This works with xy:

\documentclass{article}
\usepackage{amssymb}
\usepackage[all,cmtip]{xy}
\begin{document}
\[
\xymatrix{
  & G \ar@{-}[dr] \ar@{-}[dl] \\
  \mathbb{Z}_p \ar@{-}[dr] & & \mathbb{Z}_q \ar@{-}[dl] \\
  & \{e\}
}
\qquad
\xymatrix{
  & HK \ar@{=}[dr] \ar@{-}[dl]\\
  H \ar@{=}[dr] & & K \ar@{-}[dl]\\
  & H\cap K
}
\]
\end{document}

enter image description here

David Carlisle
  • 757,742
egreg
  • 1,121,712
  • not in lyx. I added to latex-prwmble usepackage{xypic}, added in formula these sketches but nothing seems to happen except long code. – Danis Fischer Aug 26 '13 at 16:15
  • @CoarguAliquis Sorry, but LyX is something I can't think to. My opinion is that it makes more difficult, rather than simpler, inputting LaTeX code. – egreg Aug 26 '13 at 16:16
  • Reseted lyx and now works like a charm. Thanks :) – Danis Fischer Aug 26 '13 at 16:21
  • When you get a useful answer to a question you should accept it, and vote it up. You can even vote up more than one answer. Please go back to your other questions and take care of this there too. – Ethan Bolker Aug 26 '13 at 17:08