Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

A follow-up question to this one Aligning subcaptions with tikz pictures vertically

This is the code I am using, worked to a pretty minimal scenario:

\documentclass{article}
\usepackage{float, tikz, subfigure, array, caption, subcaption}
\usetikzlibrary{calc}

\newcommand{\alignedsublabel}[1]{%
\node at ($(current bounding box.south west)!(#1)!(current bounding box.south east)$) [anchor=base,text depth=0pt,yshift=-3ex] {\parbox{10em}{\subcaption[]{}}};%
}

\begin{document}

\begin{figure}
\begin{tikzpicture}[level/.style={sibling distance=35mm/#1}, scale=0.8]
\node [circle,draw] (z){1} 
  child {node [circle,draw] (a) {8}
    child {node [circle,draw] (b) {6}
      child {node [circle,draw] (c) {5}}
      child[draw=white] {node [circle,draw,fill=gray] (d) {9}}
    }
    child {node [circle,draw] (g) {3}}
  }
  child {node [circle,draw] (j) {7}
    child {node [circle,draw] (k) {2}}
    child {node [circle,draw] (l) {4}}
};
\alignedsublabel{z.center}{}
\end{tikzpicture}
\caption{This is a picture of something.}
\end{figure}

\end{document}

The problem is with line 26 (\alignedsublabel). This results in Missing numbers, treated as zero errors. If I take it out, everything compiles fine. I'm not exactly sure what parts of the .log file could be relevant, but this is what it says:

<snip>
("C:\Program Files (x86)\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count132
\scratchdimen=\dimen181
\scratchbox=\box42
\nofMPsegments=\count133
\nofMParguments=\count134
\everyMPshowfont=\toks36
\MPscratchCnt=\count135
\MPscratchDim=\dimen182
\MPnumerator=\count136
\everyMPtoPDFconversion=\toks37
) ABD: EveryShipout initializing macros
Package caption Info: Begin \AtBeginDocument code.
Package caption Info: End \AtBeginDocument code.

! Missing number, treated as zero.
<to be read again> 
                   \caption@c@figure 
l.30 \alignedsublabel{z.center}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing = inserted for \ifnum.
<to be read again> 
                   \caption@c@figure 
l.30 \alignedsublabel{z.center}

I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero.
<to be read again> 
                   \caption@c@figure 
l.30 \alignedsublabel{z.center}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

[1
Non-PDF special ignored!{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map}

]
<snip>

Any ideas? Please let me know if anything else in the .log file could be helpful as well, I only thought this would be the most relevant piece of information.

share|improve this question
2  
If you remove the subfigure package, the code compiles fine. I think this is a conflict between subcaption and subfigure (it is frequently recommended to use subfig instead of subfigure, by the way). –  Jake Jun 5 '11 at 13:17
1  
Sorry, seems like I was too hasty to post a question. Since I'm a newbie with latex, I do not why it was so, but seems like it didn't like the subfigure-package. In my "real document" I was using a latex class which included it... So, problem solved it seems. @Jake Indeed, thanks :) –  Rask Jun 5 '11 at 13:17
    
@Rask: Welcome to tex.sx! Usually, we don't put a greeting or a "thank you" in our posts. While it might seem strange at first, it is not a sign of a lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. A tip: you can use backticks ` to mark your inline code as I did in my edit. –  doncherry Jun 5 '11 at 13:26
    
@Jake: Could you make your comment into an answer. So that this doesn't stay on the unanswered list. –  Caramdir Jun 5 '11 at 16:42
2  
@Jake: Doesn't hurt to keep this. If it is useful to one other person, its fine. –  Caramdir Jun 5 '11 at 16:47
show 2 more comments

2 Answers

If you remove the subfigure package, the code compiles fine. I think this is a conflict between subcaption and subfigure.

share|improve this answer
    
Since the OP is already using subcaption, there's no need to use subfig. –  Gonzalo Medina Apr 16 '12 at 2:42
    
@GonzaloMedina: I've removed the bit about subfig. –  Jake Apr 16 '12 at 5:08
add comment

Your errors should be something similar to this one:

I did the following mistake in LaTeX code:

$\box(p\land q)$

instead of

$\Box(p\land q)$

\box is a TeX macro defined by \setbox, for example:

\setbox0=\hbox{mushroom} defines \box0 as \hbox{mushroom}, every time \box0 is typed it is replaced by \hbox{mushroom}.

The error message refer to a digit missing, like 0 in the TeX code \box(.. because I did a case typo, instead of the correct LaTeX macro \Box(...

See TeX for the Impatient book, located in plain/impatient/book.pdf in the TeX Live documentation directory to see about TeX macros.

share|improve this answer
1  
Welcome to TeX.sx! You can mark code by selecting the text and hitting Ctrl + K, or clicking the button marked {} above the textfield. This adds backticks (`) around inline code, or indents by four spaces for code blocks. –  Torbjørn T. Apr 11 '12 at 17:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.