Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm writing a report, and, for editorial purposes, I would like to use different fonts for each part of the report. I think I need to write a macro for it, but I don't know how to have this effect:

\begin{editLater}
//Use times font for this

\end{editLater}

Or

\begin{finalVersion}
//Use new roman font for this

\end{finalVersion}
share|improve this question
    
Does it have to be Times and New Roman? Can it not be simply serif and sans-serif? –  Martin Scharrer May 14 '12 at 10:36
    
Sure! Just need to use different fonts for different parts of the text. –  asghar ashgari May 14 '12 at 10:38

2 Answers 2

up vote 10 down vote accepted

You can use the font switch macros \rmfamily, \sffamily etc. to switch the font inside the current group. You can define your own environment using \newenvironment.

Changing to a different totally different font locally is more complicated. You should load all font packages with the main font last and then need to rename certain font macros like \rmdefault below.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{mathptmx} % Times
\usepackage{lmodern}  % LaTeX modern

\usepackage{blindtext}% dummy text

\newenvironment{editLater}{%
    \def\rmdefault{ptm}\rmfamily
}{}
\newenvironment{finalVersion}{%
    \rmfamily
    %\sffamily
}{}

\begin{document}

\blindtext

\begin{editLater}
\blindtext
\end{editLater}

\begin{finalVersion}
\blindtext
\end{finalVersion}

\end{document}
share|improve this answer
    
Works peacefully! Many thanks :-). –  asghar ashgari May 14 '12 at 11:10
    
@asgharashgari: Clad I could help. Note that you can accept one answer per question using the tick symbol on the upper left side of the answer. This concludes the question and assigns reputation to the answerer and to you. You can always change the accepted answer later. –  Martin Scharrer May 17 '12 at 12:40

Same as Martin's answer but uses versions to switch over after editing to final version. I could not resist myself from posting, so kindly bear with me.

\documentclass{article}
\usepackage{lipsum} %% Provides dummy text
\usepackage[T1]{fontenc}
%-------------------------------------------------------
\newenvironment{editLater}{\fontfamily{ptm}\selectfont}{\par}
\newenvironment{finalVersion}{\fontfamily{cmr}\selectfont}{\par}
%-------------------------------------------------------
\usepackage{versions}
% \excludeversion{editLater} %% uncomment this line if you want final  version alone
%-------------------------------------------------------

\begin{document}
%% once you edit completely, change editLater to finalVersion inside braces.
\begin{editLater}
\lipsum[1-2]
\end{editLater}
\begin{finalVersion}
\lipsum[3-4]
\end{finalVersion}
\end{document} 

Edit

This uses comment package.

\documentclass{article}
\usepackage{lipsum} %% Provides dummy text
\usepackage[T1]{fontenc}
%-------------------------------------------------------
% \newcommand{\editLater}[2]{{\fontfamily{ptm}\selectfont #2}}
% \newcommand{\finalVersion}[2]{{\fontfamily{cmr}\selectfont #2}}
%-------------------------------------------------------
\newenvironment{editLater}{\fontfamily{ptm}\selectfont}{\par}
\newenvironment{finalVersion}{\fontfamily{cmr}\selectfont}{\par}
%-------------------------------------------------------
\usepackage{comment}
%\excludecomment{editLater} %% uncomment this line if you want final  version alone
%-------------------------------------------------------

\begin{document}
%% once you edit completely, change editLater to finalVersion inside braces.
\begin{editLater}
\lipsum[1-2]
\end{editLater}
\begin{finalVersion}
\lipsum[3-4]
\end{finalVersion}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.