Including graphics using LaTeX
Home > LaTeX > Including graphics using LaTeX
Including eps figures in LaTeX
If we directly try to use eps image using \includegraphics then we get error '! LaTeX Error: Unknown graphics extension: .eps.' which can be solved by adding
\usepackage{epstopdf}
We should use eps images created using Xfig in LaTeX files if we do not want them to get badly distorted on zoom in and zoom out. Xfig figures scale very smoothly without any problem in any pdf viewer on zoom in and zoom out and always appear properly.
Print frame around text
\fbox{text} can be used to print frame around text. If text is two long then it will cross page boundaries. Then \parbox{width}{text} should be used within \fbox{} so that text is properly formatted into a paragraph.
Print text with specified background color
\colorbox{color}{text} can be used to print text with background text color as specified by name color. We have to include package `color' in order to use \colorbox{}
Justifying text within fbox and colorbox
\parbox{width}{text} can be used to justify text within paragraph. It can be very useful to justify text which is large and cannot be used directly in \fbox{} or \colorbox{}{}.
For Example:
\fbox{\colorbox{yellow}{\parbox{\textwidth}{ \textbf{Query: } Look at TTL values obtained while pinging IP address of eth$<$n$>$ of your own machine and IP address of eth$<$n$>$ of partner team machine. Why is huge difference between the two TTL values? }}}
prints above query in a box with text having yellow background.
Defining our own color names
Since there are very less known color names we can use
\definecolor{lightorange}{rgb}{1.0,0.8,0.5}
kind of statement to define new color and use it whereever we want.
Change font or foreground color
We can also change foreground color using \color{color_name} within a colorbox. For example we can use
\definecolor{lightorange}{rgb}{1.0,0.8,0.5} \begin{quote} \fbox{\colorbox{lightorange}{\color{black} \parbox{0.7 \columnwidth}{ \textbf{Query: }Why aliased interface got removed after using ifdown / ifup. }}} \end{quote}
to print text in black color with background having lightorange color as defined manually.