5

How can I change the font and color of a particular command in a LaTeX document?

For example I want all the text that follows the \item tag to be gray and the font should be different from the rest of the document , which i can specify ...

2

1 Answer 1

12

To manipulate list-environments to package enumitem is really suitable. With the option before you can specify your color and font which is local to the environment:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{itemize}[before=\color{gray}\sffamily]
 \item Text in itemize with another color
 \item \lipsum[2]
\end{itemize}

\lipsum[3]
\end{document}

enter image description here

5
  • Thanks for the answer ... But i wanted to use a font of which i have a .ttf file ... How can that be done ?
    – sairajat
    Jun 29, 2013 at 14:50
  • @user1697007: What's the question? How to use a ttf file? Jun 29, 2013 at 15:13
  • i wanted to use a particular font and color for the \itemize command .. i am now able to apply color as decribed above .. but i want to use a different font .. i have ttf file for that font and also i installed that font on my machine ... I am using MAC and Texshop ... So all i want now is to use a font for which i have the ttf file for the \itemize command ..
    – sairajat
    Jun 29, 2013 at 15:45
  • @user1697007: Your aim is to use a ttf file. This wasn't part of your original question. A ttf-file can't be used directly with LaTeX expect you are using XeLaTeX or LuaLaTeX. Then you can work fontspec and the provided command: \newfontfamily Jun 29, 2013 at 16:01
  • yes ... sorry for the confusion ... Thanks .. i will try this ...
    – sairajat
    Jun 29, 2013 at 21:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .