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
I put xspace at the end of most of my macros, e.g.
\newcommand*{\foobar}{foobar\index{foobar}\xspace}
but I just discovered that if the macro is placed inside textit, it does not work as expected, e.g.
Test 1: \foobar. Test 2: \textit{\foobar}.
produces
Test 1: foobar. Test 2: foobar .
with an extra space before the . character. Of course I could make a duplicate non-xspace macro for these case, but can I fix this more properly in some way?
I found the answer "hidden" in /usr/share/texmf/doc/latex/tools/xspace.pdf:
Sometimes \xspace may make the wrong
decision, and add a space when it is
not required. There may be different
reasons for this behavior but it can
always be handled by following the
macro with {}, as this has the effect
of suppressing the space.
So
Test 3: \textit{\foobar{}}.
produces
Test 3: foobar.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
If I create a new array with 10 elements, and populate it with the numbers 1 through 10, then call delete_at(4), the fourth element is "deleted".
How does this work, though? Does it completely remove the element and index and reduce the size of the array to 9, or does it nullify (or make nil) the value of that index and push it the the end of the array?
It copies all of the elements after the position back one with a single memory copy, then reduces the size of the array by one.
Why do you ask? Are you trying to reason about performance?
Ref: https://github.com/ruby/ruby/blob/9f45081627cf682b3ee938353da134d6f28560da/array.c#L2964
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.
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 am trying to write a code inside \code{} in .tex file.
I am eager to write
\code{
cat("\n I want to write like this!")
}
However, latex gives me ERROR message, saying that \n is undefined control sequence.
I also tried \code{$\n$} and \code{\\n}. Neither works.
(I also know that \n works in verbatim environment. But I HAVE TO use \code{})
You can try this..
\textbackslash n
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 include a figure like this
\begin{figure*}
\begin{center}
\includegraphics[width=6.7in]{pic/recall_details.png}
\caption{ Recalls of test query MB002-MB049}
\label{ recall_details}
\end{center}
\end{figure*}
And then I refer it using \ref{recall_details}. Instead of getting numbers like 1, 2, I get ??. Literally I mean ??. What is wrong with my codes? How to make the references show correctly?
You should "compile" your latex code twice to get numbers instead of question marks
The issue is that you're referencing \ref{recalls_details}, but you've defined \label{ recalls_details}. That extra space before recalls_details is what gets you ?? instead of the figure number. You should either change the \ref to \ref{ recalls_details} or the \label to \label{recalls_details}.
On another note, I suggest you add a modifier at the start of the label, such as fig: in this case: \label{fig:recalls_details}. This is useful when you have different types of labels (e.g. to sections, sec:, and to equations, eqn:).
The bottom line is to always use the exact string you give within the \label{} in the relevant \ref{}.
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.