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.

I have a command that creates a formatted minipage that is defined roughly like

\newcounter{X}
\setcounter{X}{1}
\newcommand{\assumption}[2]{
   \begin{minipage}%
     Assumption \Roman{X}: #1 \\#2%
   \end{minipage}%
   \addtocounter{X}{1}%
}

I'd like to be able to reference the minipage command. Preferably using \ref, but this isn't nescessary. Basically I would like to be able to do something like

\assumption{flatearth}{The earth is flat!}{It is obvious that this   
assumption is reasonable.}

From assumption \ref{assum:flatearth} it follows that it's \emph{real} 
circumference is $\infty$ and that the Victoria was capable of
superluminal velocities.

or just have a command like \assref{flatearth}. They should produce roman numerals corresponding to the counter X.

Apologies for the ambiguous title, I've been trying to work out what to search for, it's not so clear.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted
\newcounter{X}
\renewcommand\theX{\Roman{X}}

\newcommand{\assumption}[2]{%
\refstepcounter{X}%
\label{assum:#1}%
   \begin{minipage}%
     Assumption \theX: #1 \\#2%
   \end{minipage}%

}
share|improve this answer
    
Thanks. This is close to what I want, there is still one little bit wrong with it. The output from \ref{assum:whatever} is in Arabic not Roman numerals - is there any way of fixing this? –  Lucas Jul 13 '12 at 16:14
    
are you sure you ran latex again after adding the \renewcommand\theX{\Roman{X}} –  David Carlisle Jul 13 '12 at 16:18
    
A couple of times. I will do it a few more. Does it require the command \theX or \the<countername>? The latter it seems. Works now! Thanks. –  Lucas Jul 13 '12 at 16:31
    
once should be enough, Make a complete document "MWE" that shows the problem –  David Carlisle Jul 13 '12 at 16:34
1  
\thecountername isn't really for references it defines how that counter is printed. references just happen to use the default print format of the counter by default –  David Carlisle Jul 13 '12 at 17:35
show 2 more comments

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.