Tweaking \autoref to behave somewhat like \vref [closed] - latex

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I would like to modify the \autoref command in the following way: if the \autoref command and the label are on the same page, it behaves like \autoref* (i.e., no hyperlink). Else, it behaves usually.
Thanks,
Vishnu

If you can use \myautoref instead of \autoref, the following will work as you wished:
\documentclass{article}
\usepackage{lipsum}
\usepackage[pdftex,colorlinks]{hyperref}
\makeatletter
\def\my#setref#1#2#3{%
\ifx#1\relax\protect\G#refundefinedtrue
\else\expandafter#2#1\fi}
\def\pagenum#1{\expandafter\my#setref\csname
r##1\endcsname\#secondoffive{#1}}%
\def\myautoref#1{\def\refnum{\pagenum{#1}}%
\ifnum\refnum=\thepage\relax\autoref*{#1}%
\else\autoref{#1}\fi}
\makeatother
\begin{document}
\section{First}\label{first}
\lipsum[1-3]
\myautoref{first}
\lipsum[4-8]
\myautoref{first}
\end{document}

I had to solve a similaire problem and found something shorter (more easy to understand for me):
\usepackage{ifthen}
\newcommand{\myautoref}[1]{
\ifthenelse%
{\equal{\pageref{#1}}{\thepage}}%
{\autoref*{#1}}%
{\autoref{#1}}
}

Related

How can I write this function (image) in Latex? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
How can I write this function (image) in Latex?
This should lay a sufficient foundation:
\documentclass{article}
\setlength{\parindent}{0pt}% Just for this example
\begin{document}
$f \colon \{0,1\}^N \rightarrow \{0,1\}^M$
$f \colon \{0,1\}^N \mapsto \{0,1\}^M$
\end{document}
You can change the spacing around : (or \colon) as needed, perhaps using f~\colon~.

How to delete text in all occurences of a specific tag in Latex [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
In my latex document I have use the tag \sout , to strike out some texts, in many places. Is there a one-shot way to delete the text in all the occurrences of the tag along with the tag ?
You could redefine the way \sout works by including the following in your document preamble:
\renewcommand{\sout}[1]{\unskip}
Here's an example illustrating the effect:
\documentclass{article}
\usepackage{ulem}% http://ctan.org/pkg/ulem
\begin{document}
Here is some \sout{text} stuff.
\renewcommand{\sout}[1]{\unskip}
Here is some \sout{text} stuff.
\end{document}
If you're using an editor that allows for searching with regular expressions, then you could do a find for the regular expression \\sout\{[^\}]+\} (note that this is untested) and replace with an empty string or space.

input a figure between title and body in twocolumn latex form [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm using a Latex to write a small paper using CVPR template.
I'd like to put a figure between my title+name and body(which consists with two columns) like many CVPR papers do, but I don't find the way to do that.
I tried,
\begin{figure*}
\begin{center}
\fbox{\rule{0pt}{2in} \rule{.9\linewidth}{0pt}}
\end{center}
\caption{some caption..}
\label{fig:short}
\end{figure*}
but it turned out figure-star only displays it's figure at the top of next page,
and when I just use figure like \begin{figure}[htb], it's only located one of those two columns.
Does anyone know how to put a long figure between my title+name and body context?
Thanks.
You don't mention anything about inserting a date in your title. So, why not use the date to store your image:
\documentclass[twocolumn]{article}
\usepackage{mwe}% http://ctan.org/pkg/mwe
\title{My Title}
\author{A.\ Uthor}
\date{\includegraphics[height=2in]{example-image}}
\begin{document}
\maketitle
\lipsum[1-4]
\end{document}
The mwe package provides the example image (via graphicx) and dummy text (via lipsum).

margins of book class in latex [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I would know which are the margins (in meters) top,right,bottom and left, default assigned for bookclass. there is a command or a way to know them?
It depends on whether you want to include the header/footer and possibly even if you use twoside document. Perhaps the following minimal working example can be a start:
\documentclass{book}
\usepackage{layouts}% http://ctan.org/pkg/layouts
\begin{document}
\pagevalues
\end{document}
uses the layouts package to produce
All units are printed in points by default, and there are 0.0351459 points per cm. Note that LaTeX does not use metres as a valid length.

How to change the space between the itemize items in latex? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
How to change the space between the itemize "items" in latex so that I can continue to use the "itemize" and "item" tag without needing to redefine any new tags?
Thank for your help!
You could set the separating space inside an itemize environment.
\begin{itemize}
\setlength{\itemsep}{5pt}
\item Item1
\item Item2
\end{itemize}
Alternatively, afaik, you would need to create your own environment.

Resources