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.

Take an example, if a theorem written in section 1, it will be marked Theorem 1.x . In spite of those, can it be marked Theorem 2.x without moved into section 2?

It sounds a bit strange, but it is a problem someone will really meet once in a while, such as in using Laeqed to convert a single theorem to an image file. In this case it will be shown as Theorem 0.1 since the information of section is not concluded.

share|improve this question
    
How exactly are you building the theorem-structure? If you use something like \newtheorem{theo}{Theorem}, you can say {\renewcommand\thetheo{2.\arabic{theo}}\begin{theo}...\end{theo}} (the pair of outer braces is just to keep the redefinition local). –  Gonzalo Medina Mar 14 '13 at 2:11
add comment

1 Answer

up vote 3 down vote accepted

You can redefine the representation of the counter associated to the environment that gives you the theorem:

\documentclass{article}
\usepackage{amsthm}

\newtheorem{theo}{Theorem}[section]
\begin{document}
\section{Test Section One}

{
\renewcommand\thetheo{2.\arabic{theo}}
\begin{theo}
test
\end{theo}
}

\end{document}

enter image description here

The pair of outer braces is just to keep the redefinition local.

Using the \label, \ref mechanism, the section number doesn't have to bee hard-coded:

\documentclass{article}
\usepackage{amsthm}

\newtheorem{theo}{Theorem}[section]
\begin{document}

\section{Test Section One}
\label{sec:one}
{
\renewcommand\thetheo{\ref{sec:two}.\arabic{theo}}
\begin{theo}
test
\end{theo}
}

\section{Test Section One}
\label{sec:two}

\section{Test Section One}
\label{sec:three}

\end{document}
share|improve this answer
    
It's nice, thanks. –  Popopo Mar 14 '13 at 17:37
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.