Text FormattingNonstandard cross references

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm

Nonstandard cross references

Post by bkarpuz »

Dear LC members,

I have the following code

Code: Select all

\documentclass[10pt,reqno]{article}

\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[top=36.9mm,bottom=20mm,left=20mm,right=20mm]{geometry}
\usepackage[pdfstartview=FitV,bookmarks=false]{hyperref}

\numberwithin{equation}{section}

\newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{lemma}{Lemma}[section]

\begin{document}
Consider the differential equation
\begin{equation}
u^{(n)}(t)+a(t)u(t)=0\quad\text{for}\ t\in[0,\infty),\label{eq1}
\end{equation}
where $n\geq3$ and $a:[0,\infty)\to\mathbb{R}$ is continuous.
We generally assume that one of the following inequalities is satisfied:
\begin{equation}
a(t)\geq0\quad\text{for}\ t\in[0,\infty)\label{eq2}
\end{equation}
or
\begin{equation}
a(t)\leq0\quad\text{for}\ t\in[0,\infty).\label{eq3}
\end{equation}
We understand a solution of \eqref{eq1} to be a nontrivial solution defined on $[0,\infty)$.
A solution of \eqref{eq1} is said to be oscillating if it has an enumerable number of zeros,
and nonoscillating otherwise.
Equation~\eqref{eq1} is called nonoscillatory if all of its solutions are nonoscillating,
and oscillatory if at least one solution is oscillating.

\begin{lemma}\label{prlm1}
Let inequality \eqref{eq2} [inequality \eqref{eq3}] be satisfied and let $u$ be a solution of \eqref{eq1} such that
\begin{equation}
u(t)>0\quad\text{for all}\ t\in[t_{0},\infty).\notag
\end{equation}
Then there are numbers $t_{1}\in[t_{0},\infty)$ and $\ell\in\{0,1,\cdots,n\}$ such that $(n+\ell)$ is odd [even] and
\begin{equation}
\begin{gathered}
u^{(i)}(t)>0\quad\text{for all}\ t\in[t_{1},\infty)\ \text{and}\ i=0,1,\cdots,\ell-1\\
(-1)^{\ell-i}u^{(i)}(t)>0\quad\text{for all}\ t\in[t_{1},\infty)\ \text{and}\ i=\ell,\ell+1,\cdots,n.
\end{gathered}\label{prlm1eq1}\tag{\theequation$_{\ell}$}
\end{equation}
\end{lemma}

\begin{lemma}\label{prlm2}
If inequality \eqref{eq2} is satisfied,
then for \eqref{eq1} to have a solution satisfying condition ($0.3_{n-1}$) it is necessary and sufficient
that the equation
\begin{equation}
u^{(n)}(t)+(-1)^{n}a(t)u(t)=0\quad\text{for}\ t\in[0,\infty),\label{prlm3eq1}
\end{equation}
has a solution satisfying condition ($0.3_{1}$).
\end{lemma}

\end{document}
In Lemma 2 (at the end of the code above), I want the texts ($0.3_{n-1}$) and ($0.3_{1}$) refer the equation having the label prlm1eq1 (the equation in Lemma 1). I mean when I click the text ($0.3_{n-1}$) and ($0.3_{1}$), the hyperref package should take me to the equation having the label prlm1eq1. I have no idea how to do it. Please help me…

Many thanks.
bkarpuz
Last edited by bkarpuz on Sun Dec 11, 2011 10:40 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Nonstandard cross references

Post by nlct »

I think \hyperref[label]{text} is what you're looking for:

Code: Select all

\hyperref[eq1]{($0.3_{n-1}$)}
Regards
Nicola Talbot
bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm

Nonstandard cross references

Post by bkarpuz »

nlct wrote:I think \hyperref[label]{text} is what you're looking for:

Code: Select all

\hyperref[eq1]{($0.3_{n-1}$)}
Regards
Nicola Talbot
Thank you very much nlct!

Is there a command that can return me 0.3 from the label prlm1eq1?

Correction. Replaced eq1 with prlm1eq1.
Last edited by bkarpuz on Sun Dec 11, 2011 4:37 pm, edited 1 time in total.
User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Nonstandard cross references

Post by nlct »

Is there a command that can return me 0.3 from the label eq1?
Did you mean "prlm1eq1"? Since \tag prevents the equation counter from being incremented, perhaps it would be better to increment it manually so that you have equation 0.4_{\ell} instead of 0.3_{\ell} (which may be confused with the previous equation).

Code: Select all

\refstepcounter{equation}\label{prlm1eq1}%
\begin{equation}
\begin{gathered}
u^{(i)}(t)>0\quad\text{for all}\ t\in[t_{1},\infty)\ \text{and}\
i=0,1,\cdots,\ell-1\\
(-1)^{\ell-i}u^{(i)}(t)>0\quad\text{for all}\ t\in[t_{1},\infty)\
\text{and}\ i=\ell,\ell+1,\cdots,n.
\end{gathered}\tag{\theequation$_{\ell}$}
\end{equation}
\end{lemma}
Then you can reference it using

Code: Select all

(\ref{prlm1eq1}$_{(n-1)}$)
Regards
Nicola Talbot
bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm

Nonstandard cross references

Post by bkarpuz »

nlct wrote: Did you mean "prlm1eq1"?
Yes, you are right! I meant prlm1eq1.
nlct wrote:

Code: Select all

\refstepcounter{equation}\label{prlm1eq1}%
\begin{equation}
\begin{gathered}
u^{(i)}(t)>0\quad\text{for all}\ t\in[t_{1},\infty)\ \text{and}\
i=0,1,\cdots,\ell-1\\
(-1)^{\ell-i}u^{(i)}(t)>0\quad\text{for all}\ t\in[t_{1},\infty)\
\text{and}\ i=\ell,\ell+1,\cdots,n.
\end{gathered}\tag{\theequation$_{\ell}$}
\end{equation}
\end{lemma}
Thank you for the code again nlct. You gave me what I was exactly looking for.

Actually, I want to define a new ref command like \cref (custom reference) in such a way that \cref[$\ell$]{prlm1eq1} does the job.

I could define the following code

Code: Select all

\newcommand{\cref}[2][1]{{\textup{(}\hyperref[#2]{\textup{\ref{#2}}$_{#1}$}\textup{)}}}
but when I use this as (here I updated the code as in your last post)

Code: Select all

\cref[n-1]{prlm1eq1}
it returns me what I want but the output of \ref{prlm1eq1} is surrounded with the hyperref link box too. :(
How can I get rid of the hyperref of \ref{prlm1eq1}?

See the complete code below.

Code: Select all

\documentclass[10pt,reqno]{article}

\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[top=36.9mm,bottom=20mm,left=20mm,right=20mm]{geometry}
\usepackage[pdfstartview=FitV,bookmarks=false]{hyperref}

\newcommand{\cref}[2][1]{{\textup{(}\hyperref[#2]{\textup{\ref{#2}}$_{#1}$}\textup{)}}}

\numberwithin{equation}{section}

\newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{lemma}{Lemma}[section]

\begin{document}
Consider the differential equation
\begin{equation}
u^{(n)}(t)+a(t)u(t)=0\quad\text{for}\ t\in[0,\infty),\label{eq1}
\end{equation}
where $n\geq3$ and $a:[0,\infty)\to\mathbb{R}$ is continuous.
We generally assume that one of the following inequalities is satisfied:
\begin{equation}
a(t)\geq0\quad\text{for}\ t\in[0,\infty)\label{eq2}
\end{equation}
or
\begin{equation}
a(t)\leq0\quad\text{for}\ t\in[0,\infty).\label{eq3}
\end{equation}
We understand a solution of \eqref{eq1} to be a nontrivial solution defined on $[0,\infty)$.
A solution of \eqref{eq1} is said to be oscillating if it has an enumerable number of zeros,
and nonoscillating otherwise.
Equation~\eqref{eq1} is called nonoscillatory if all of its solutions are nonoscillating,
and oscillatory if at least one solution is oscillating.

\begin{lemma}\label{prlm1}
Let inequality \eqref{eq2} [inequality \eqref{eq3}] be satisfied and let $u$ be a solution of \eqref{eq1} such that
\begin{equation}
u(t)>0\quad\text{for all}\ t\in[t_{0},\infty).\notag
\end{equation}
Then there are numbers $t_{1}\in[t_{0},\infty)$ and $\ell\in\{0,1,\cdots,n\}$ such that $(n+\ell)$ is odd [even] and
\refstepcounter{equation}\label{prlm1eq1}%
\begin{equation}
\begin{gathered}
u^{(i)}(t)>0\quad\text{for all}\ t\in[t_{1},\infty)\ \text{and}\
i=0,1,\cdots,\ell-1\\
(-1)^{\ell-i}u^{(i)}(t)>0\quad\text{for all}\ t\in[t_{1},\infty)\
\text{and}\ i=\ell,\ell+1,\cdots,n.
\end{gathered}\tag{\theequation$_{\ell}$}
\end{equation}
\end{lemma}

\begin{lemma}\label{prlm2}
If inequality \eqref{eq2} is satisfied,
then for \eqref{eq1} to have a solution satisfying condition \cref[n-1]{prlm1eq1} it is necessary and sufficient
that the equation
\begin{equation}
u^{(n)}(t)+(-1)^{n}a(t)u(t)=0\quad\text{for}\ t\in[0,\infty),\label{prlm3eq1}
\end{equation}
has a solution satisfying condition \cref[1]{prlm1eq1}.
\end{lemma}

\end{document} 
Many many thanks!
bkarpuz
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Nonstandard cross references

Post by sommerfee »

bkarpuz wrote:How can I get rid of the hyperref of \ref{prlm1eq1}?t

Code: Select all

\ref*{prlm1eq1}
bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm

Nonstandard cross references

Post by bkarpuz »

sommerfee wrote:

Code: Select all

\ref*{prlm1eq1}
Thank you too sommerfee!
Now I have what I want! :p

The final code is

Code: Select all

\newcommand{\cref}[2][1]{{\textup{(\hyperref[#2]{\ref*{#2}$_{#1}$})}}}
and here is how to use it

Code: Select all

\documentclass[10pt,reqno]{article}

\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[top=36.9mm,bottom=20mm,left=20mm,right=20mm]{geometry}
\usepackage[pdfstartview=FitV,bookmarks=false]{hyperref}

\newcommand{\cref}[2][1]{{\textup{(\hyperref[#2]{\ref*{#2}$_{#1}$})}}}

\numberwithin{equation}{section}

\newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{lemma}{Lemma}[section]

\begin{document}
Consider the differential equation
\begin{equation}
u^{(n)}(t)+a(t)u(t)=0\quad\text{for}\ t\in[0,\infty),\label{eq1}
\end{equation}
where $n\geq3$ and $a:[0,\infty)\to\mathbb{R}$ is continuous.
We generally assume that one of the following inequalities is satisfied:
\begin{equation}
a(t)\geq0\quad\text{for}\ t\in[0,\infty)\label{eq2}
\end{equation}
or
\begin{equation}
a(t)\leq0\quad\text{for}\ t\in[0,\infty).\label{eq3}
\end{equation}
We understand a solution of \eqref{eq1} to be a nontrivial solution defined on $[0,\infty)$.
A solution of \eqref{eq1} is said to be oscillating if it has an enumerable number of zeros,
and nonoscillating otherwise.
Equation~\eqref{eq1} is called nonoscillatory if all of its solutions are nonoscillating,
and oscillatory if at least one solution is oscillating.

\begin{lemma}\label{prlm1}
Let inequality \eqref{eq2} [inequality \eqref{eq3}] be satisfied and let $u$ be a solution of \eqref{eq1} such that
\begin{equation}
u(t)>0\quad\text{for all}\ t\in[t_{0},\infty).\notag
\end{equation}
Then there are numbers $t_{1}\in[t_{0},\infty)$ and $\ell\in\{0,1,\cdots,n\}$ such that $(n+\ell)$ is odd [even] and
%All the job is done here!
\refstepcounter{equation}\label{prlm1eq1}%
\begin{equation}
\begin{gathered}
u^{(i)}(t)>0\quad\text{for all}\ t\in[t_{1},\infty)\ \text{and}\
i=0,1,\cdots,\ell-1\\
(-1)^{\ell-i}u^{(i)}(t)>0\quad\text{for all}\ t\in[t_{1},\infty)\
\text{and}\ i=\ell,\ell+1,\cdots,n.
\end{gathered}\tag{\theequation$_{\ell}$}
\end{equation}
\end{lemma}

\begin{lemma}\label{prlm2}
If inequality \eqref{eq2} is satisfied,
then for \eqref{eq1} to have a solution satisfying condition \cref[n-1]{prlm1eq1} it is necessary and sufficient
that the equation
\begin{equation}
u^{(n)}(t)+(-1)^{n}a(t)u(t)=0\quad\text{for}\ t\in[0,\infty),\label{prlm3eq1}
\end{equation}
has a solution satisfying condition \cref[1]{prlm1eq1}.
\end{lemma}

\end{document} 
Post Reply