4

I am using the package amscd to make commutative diagrams, with CD environment and I want to know how can I change the size of the result (especially make it bigger).

I try this

\[
\scalebox{1.4}{  
\begin{CD}  
C @>\phi>> C'=\phi(C)\\  
@V\textnormal{Dual}VV\\  
C^{\perp}@>\phi>> C=\phi(C^{\perp})  
\end{CD}  
}  
\]  

And it works, except that i get an error, something like missing $ or extra }, can anyone help me?

LaRiFaRi
  • 43,807
Dimitri
  • 545
  • 2
  • 4
  • 10

4 Answers4

5

This is a possibility: define a key-value interface for CD and modify how the vertical arrows are built.

However, using a dedicated package such as xy or the more recent TikZ based tikz-cd is recommended.

\documentclass{article}
\usepackage{amscd,keyval}

\makeatletter
\define@key{modCD}{cols}{\setlength{\minCDarrowwidth}{#1}}
\define@key{modCD}{rows}{\setlength{\modCD@rowsep}{#1}}
\newlength{\modCD@rowsep}

\renewenvironment{CD}[1][]
 {\modCD@rowsep=20\ex@ % default
  \setkeys{modCD}{#1}%
  \CDat
  \bgroup\relax\iffalse{\fi\let\ampersand@&\iffalse}\fi
  \CD@true\vcenter\bgroup\let\\\math@cr\restore@math@cr\default@tag
  \tabskip\z@skip\baselineskip20\ex@
  \lineskip3\ex@\lineskiplimit3\ex@\halign\bgroup
  &\hfill$\m@th##$\hfill\crcr}
 {\crcr\egroup\egroup\egroup}
\atdef@ V#1V#2V{\CD@check{V..V..V}{%
  \llap{$\m@th\vcenter{\hbox{$\scriptstyle#1$}}$}%
  \left\downarrow\vbox to.5\modCD@rowsep{}\right.\kern-\nulldelimiterspace
  \rlap{$\m@th\vcenter{\hbox{$\scriptstyle#2$}}$}&&}}
\atdef@ A#1A#2A{\CD@check{A..A..A}{%
  \llap{$\m@th\vcenter{\hbox{$\scriptstyle#1$}}$}%
  \left\uparrow\vbox to.5\modCD@rowsep{}\right.\kern-\nulldelimiterspace
  \rlap{$\m@th\vcenter{\hbox{$\scriptstyle#2$}}$}&&}}
\makeatother

\begin{document}
\[
\begin{CD}
A @>f>> B \\
@VxVV @AAyA\\
C @>g>> D
\end{CD}
\]
\[
\begin{CD}[rows=30ex,cols=10em]
A @>f>> B \\
@VxVV @AAyA\\
C @>g>> D
\end{CD}
\]
\end{document}

The row separation is approximately what's specified in rows=, while cols= specifies the minimum horizontal arrow width.

enter image description here

egreg
  • 1,121,712
2

Sure you can scale it, if a total resize of the diagram is what is desired:

\documentclass{article}
\usepackage{amscd}
\usepackage{scalerel}
\begin{document}
Voila!~~~~~~~$
  \scaleto{%
    \begin{CD}
    A @>f>> B \\
    @VxVV @AAyA\\
    C @>g>> D
  \end{CD}
}{150pt}
$
\end{document}

enter image description here

David Carlisle
  • 757,742
  • This sounds what i am looking for, but i have a problem, something like: can´t find scalerel.sty file, can you help me? – Dimitri Mar 01 '13 at 19:33
  • @Dimitri I just uploaded scalerel to ctan the other day, so it may not have propagated to you yet. In the meantime, you can find sty file at http://tex.stackexchange.com/questions/95047/how-to-horizontally-merge-two-symbols/100168#100168 – Steven B. Segletes Mar 01 '13 at 23:28
  • @Dimitri Package can be found also at http://ctan.org/tex-archive/macros/latex/contrib/scalerel – Steven B. Segletes Mar 01 '13 at 23:33
1

It would be easier to switch to tikz-cd. If you do so, you can use any answer from this post. The \makemathbox{} commands are optional. They just give every edge a certain width in order to get the arrows to the same length. As asked by the OP, I scaled the whole image, say, arrows, characters, and linethickness.

% arara: pdflatex

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

\begin{document}     
\[
\begin{tikzcd}[transform canvas={scale=5}]
\mathmakebox[1em][c]{C} \arrow{r}{\phi} \arrow{d}[swap]{\text{Dual}} & \mathmakebox[5em][c]{C^{\prime}=\phi(C)}\\
\mathmakebox[1em][c]{C^\perp} \arrow{r}{\phi}& \mathmakebox[5em][c]{C=\phi(C^{\perp})}
\end{tikzcd}
\]
\end{document}

enter image description here

LaRiFaRi
  • 43,807
0

You can't change the size of amscd commutative diagrams internally, except that you can increase the minimum length of a horizontal arrow:

\[\minCDarrowwidth55pt\begin{CD}...\end{CD}\].
anon
  • 21
  • 1