How to write \n inside the \code{} in latex [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 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

Related

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.

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.

Split arbitratry string into lines [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
I have an arbitratry string, something like QKOTRFLARGEBRAAFFALGORITHMMIMISSSTUPIDCROCODOLCONCEALEDKSBABA...
and I need to tell LaTeX to split this string neatly into lines. It is not a word, there should be no '-' when splitting line. Just fit these data into lines, break wherever it suits.
I have successfully used the seqsplit package for that.

latex: xspace not suppressing space in combination with textit [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
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.

How to hide the page number in LaTex on first page of a chapter? [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
How to hide the page number on first page of a chapter in LaTeX.
\thispagestyle{empty}
You could also use the titlesec package to get tremendous control over each chapter:
% This is done with the titlesec package
\titleformat{\chapter}[display]
{\normalfont\Large\filcenter} % {fmt}
{\thechapter.\ } % {label}
{1pc} % {sep}
{\vspace{-1in}\enlargethispage{-0.5in}\thispagestyle{empty}} % {before}

Resources