How can I highlight text in latex [closed] - latex

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
How can i highlit text in latex.
Thank you.
As is pictured here(in red circle):

If you mean making the text bold by Highlighting you can use \textbf for making the text bold but highlighting has a different general meaning that is implemented by \hl keyword.
\documentclass{report}
\usepackage{color} % for the command \textcolor
\usepackage{soul} % for the command \hl
\begin{document}
\hl{foo}
\hl{\textbf{foo}}
{my garden }
\textbf{black}{foo}
{my good job}
\textbf{\textcolor{red}{\hl{foo}}}
\textcolor{red}{\textbf{\hl{foo}}}
\end{document}
this is the result :
As you can see the word "black" is highlighted the way you desired.
The word "foo" is highlighted in the general meaning of highlighting.

This links look useful:
Insert symbols inside verbatim mode LaTeX
Putting math inside a verbatim environment without altering the formatting
If you just wanted graph.exe I would suggest using \begin{verbatim} graph.exe \end{verbatim} or \verb+graph.exe+ .
However you want to use the <..> expression which can be created with $ \langle ... \rangle $ . The $..$ indicates inline math mode. Those two links discuss getting verbatim text in math environments.
I think tex.stackexchange.com will be more helpful rather than stack overflow.

Related

What can cause \ref{} of LaTex output a [??] [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
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{}.

\begin{figure}[H] works, but \begin{figure}[htbp] doesn't [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 want to insert png files into my document.
basically, like this, it works (after invoking 'float'),
\begin{figure}[H]
\begin{center}
\includegraphics{myfigure}
\caption{short caption}{VERY LONG FIGURE LEGEND}
\label{fig:myfigure}
\end{center}
\end{figure}
but like that, it doesn't,
\begin{figure}[htbp!]
\begin{center}
\includegraphics{myfigure}
\caption{short caption}{VERY LONG FIGURE LEGEND}
\label{fig:myfigure}
\end{center}
\end{figure}
which is weird to me; obviously I invoke \usepackage{graphicx} as well since without that it wouldn't work in the first place. Any suggestions what the problem could be?
UPDATED: found the solution:
I had defined the \textsuperscript macro as in http://anthony.liekens.net/index.php/LaTeX/SubscriptAndSuperscriptInTextMode
a fix is sketched in Figures occurring after ^ and _ macros (was: LaTeX limitation?), and it seems to work for me
cheers!!
I can't test it here, but I think the combination htbp and ! is not allowed. The ! defines that LaTeX should listen to the given placement specifier and place the figure how you specify it. You say with htbp! to LaTeX something like
Place my image here, at the top, at the bottom or on a special page. And do it all!
You should choose either htbp or h!, t!, b! or p!, I think.
found the solution:
I had defined the \textsuperscript macro as in http://anthony.liekens.net/index.php/LaTeX/SubscriptAndSuperscriptInTextMode
a fix is sketched in Figures occurring after ^ and _ macros (was: LaTeX limitation?) and it seems to work for me

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).

Remove spacing before \chapter 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
I am using the book style to write a research report and would like to know how to remove the top vertical space before a chapter heading. I need this for the 'Abstract' page. I would like it to start nearer to the top than standard chapters.
Here is some sample code using the titlesec package, Stefan's suggestion. The titleformat command leaves everything at default values, but you need to include it (I think) for the titlespacing changes to work. The second titlespacing command sets back to default values, with assumption that you wanted altered spacing only for first chapter:
\documentclass{book}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
% this alters "before" spacing (the second length argument) to 0
\titlespacing*{\chapter}{0pt}{0pt}{40pt}
\begin{document}
\chapter{One}
% this changes "before" spacing back to its default of 50pt
\titlespacing*{\chapter}{0pt}{50pt}{40pt}
First sentence of chapter.
\chapter{two}
First sentence of chapter.
\chapter{three}
First sentence of chapter.
\end{document}
An easy way is using the titlesec package. The appendix 9.2 of its documentation shows how the standard classes typeset their headings - it's not hard to copy and to modify those commands according to the own requirements.
Having the same issue, i tried out the titlesec solution, which somehow didn't work as expected (too many errors with Texshop 2.47 on OsX).
However, i worked out a simpler solution (at least for my case) with the geometry package. The deal is to call a new page geometry only for the page of interest and then restore the page geometry defined by fncychap.
% in the preamble
\documentclass[11pt,a4paper,twoside,openright]{book}
\usepackage{geometry}
\usepackage[Sonny]{fncychap}
% in the document
\frontmatter
% adapt geometry options to your needs
\newgeometry{textwidth=16cm,textheight=28cm,voffset=-2cm,bottom=0cm}
\chapter*{Abstract}
\markboth{}{}
\addcontentsline{toc}{chapter}{Abstract}
% text
\restoregeometry
% from now on fncychap takes over again
\mainmatter

How to write URLs in Latex? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
How do you write a URL in Latex?
The subscripts and everything else make the font look very strange when it compiles.
You can use \url
\usepackage{hyperref}
\url{http://stackoverflow.com/}
You just need to escape characters that have special meaning: # $ % & ~ _ ^ \ { }
So
http://stack_overflow.com/~foo%20bar#link
would be
http://stack\_overflow.com/\~foo\%20bar\#link
Here is all the information you need in order to format clickable hyperlinks in LaTeX:
http://en.wikibooks.org/wiki/LaTeX/Hyperlinks
Essentially, you use the hyperref package and use the \url or \href tag depending on what you're trying to achieve.
A minimalist implementation of the \url macro that uses only Tex primitives:
\def\url#1{\expandafter\string\csname #1\endcsname}
This url absolutely won't break over lines, though; the hypperef package is better for that.

Resources