8

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}
2
  • Does it have to be Times and New Roman? Can it not be simply serif and sans-serif? Commented May 14, 2012 at 10:36
  • Sure! Just need to use different fonts for different parts of the text. Commented May 14, 2012 at 10:38

2 Answers 2

10

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}
1
  • @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. Commented May 17, 2012 at 12:40
3

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}

You must log in to answer this question.

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