Knuth in the TeXBook gave an example of "poor
man's bold," (The TeXbook, p. 386) which can be typeset obtained by overprinting the normal weight symbol with slight offsets.
As he says:
The results are somewhat fuzzy, and
they certainly are no match for the
real thing if it's available; but poor
man's bold is better than nothing, and
once in a while you can get away with
it.
Here, one can use a similar technique and the code is shown below:
\documentclass{article}
\usepackage{graphicx,xcolor}
\usepackage{amsmath}
\def\PoorManContour#1#2#3{\leavevmode
\setbox0=\hbox{{#1}}%
\color{#3}\kern-.002em\copy0\kern-\wd0
\color{#3}\raise-.04em\copy0\kern-\wd0
\color{#3}\lower.04em\copy0\kern-\wd0
\color{#3}\raise0.04em\copy0\kern-\wd0
\color{#2}\raise-.012em\copy0\kern-\wd0
\color{#2}\kern.06em\copy0\kern-\wd0
\color{blue}\kern-.020em\lower.003em\box0
}
\begin{document}
\colorbox{gray!5}{\scalebox{5}{\PoorManContour{$\sqrt{\dfrac{A^3_i}{B^2}}$}{gray!60}{gray!60}}}
\end{document}
To achieve the best results possible one has to kern in small steps for possibly twenty steps or so. For simplicity, I have not done that. In the final version, you need to adjust the colors to suit, possibly changing the shading to white.
Edit
After reading Jan's comment below I read the manual and true, as the commenter said the easiest way to achieve what the OP wanted is to include the package without an option i.e., \usepackage{contour}
. Helps to RFM!
I don't really get the question so I hope this is what you wanted. If you include a full document (such that we copy paste and see the problem on our systems) things are much more easier.
Here, you can change the default setting within a scope but your block
style had a node distance
which was resetting every time it is issued. I've made it 2mm such that we can see the difference easier.
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,shapes.geometric,positioning}
\begin{document}
\begin{tikzpicture}[decision/.style={diamond, draw, text width=4.5em, text badly centered, node distance=3.5cm, inner sep=0pt},
block/.style ={rectangle, draw, text width=6em, text centered, rounded corners, minimum height=4em, minimum height=2em},
cloud/.style ={draw, ellipse, minimum height=2em},
line/.style ={draw,-latex'},
node distance = 1cm,
auto]
\node [block] (1st) {1st};
\node [block, right= of 1st] (2nd1) {2nd1};
\begin{scope}[node distance=2mm and 10mm]%Here we change it for everything inside this scope
\node [block, above= of 2nd1] (2nd2) {2nd2};
\node [block, below= of 2nd1] (2nd3) {2nd3};
\node [block, right= of 2nd1] (3rd1) {3rd1};
\node [block, above= of 3rd1] (3rd2) {3rd2};
\node [block, above= of 3rd2] (3rd3) {3rd3};
\end{scope}
\node [block, below= of 3rd1] (3rd4) {3rd4};
\node [block, below= of 3rd4] (3rd5) {3rd5};
\path [line] (1st) -- (2nd1);
\path [line] (2nd1) -- (2nd2);
\path [line] (2nd1) -- (2nd3);
\path [line] (2nd2) -- (3rd3);
\path [line] (2nd1) -- (3rd1);
\path [line] (1st) -- (2nd1);
\end{tikzpicture}
\end{document}
Best Answer
This is because the
tikz-cd
environment is a wrapper around a TikZ matrix and in a TikZ matrix then&
doesn't mean what it usually means. Inside a TikZ matrix then&
is a command which does a fair bit extra than the usual "hop to the next cell". However, inside an AMS matrix, you want it to be just the "hop to the next cell" that it usually is. So the two occurrences of&
in your code have different meanings but you are using the same symbol for them. There are a variety of ways to fix this:Keep the normal meaning of
&
so that it works inside the AMS matrix, in which case you need to use something else for the TikZ matrix. Fortunately, TikZ provides a way to do this: you write[ampersand replacement=\&]
(or whatever) after the\begin{tikzcd}
and then use\&
(or whatever) for the TikZ cell separator.Keep TikZ's meaning of
&
so that it works for the TikZ matrix, in which case you need to use something else for the AMS matrix. This is also quite straightforward. You put\let\amsamp=&
in your preamble and then use\amsamp
in your code (unfortunately, it would appear that\&
can't be used here).Rejig AMS's matrix environment to reset
&
to its usual meaning whilst inside its environs. This isn't quite as easy as it looks due to the fact that when the environment is read then the catcode of&
is already frozen (as it is in the argument to a macro, in this case\arrow
). So we have to do a bit of\begingroup ... \endgroup
trickery when defining the new type of matrix environment. (Obviously, to do this right one should just redefine the basic AMS matrix environment that all the others are built on top of). Note that this also works outsidetikzcd
environments because what it actually does is say "If&
is a command, let it be what&
usually is." (okay, it's slightly more complicated but that'll do for now) and in the normal circumstances&
isn't a command so this is (almost) a NO-OP.As a postscript (or PDF), I would like to point out that this is a lovely example of the distinction between fudge, Finagle, and diddle factors as explained in an article in THE IRE STUDENT QUARTERLY, SEPTEMBER 1958 (also reproduced in the wonderful book A Random Walk in Science, or it might be in More Random Walks in Science). The following is the relevant part:
Thus the first solution, which changes TikZ to fit AMS, is clearly an application of the Finagle factor. The second, which changes AMS to fit TikZ, is obviously a fudge. The last, in which everything suddenly appears to work with no outward change, is a definite diddle.