I would try something like this:
\documentclass[a4paper,oneside,12pt]{report}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% PACKAGES & SETTINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[english]{babel} % formatting rules for the English language
\usepackage[T1]{fontenc} % proper formatting for accented characters and non-standard characters such as pipelines
\usepackage{mathptmx}% fot a font which looks like Times New Roman (serif/roman)
%\usepackage{tgtermes}% an altternative
\usepackage[scaled=.90]{helvet}% for a font which looks like Helvetica, scaled to match TNR (sans)
%\usepackage{tgheros}% an altternative
\usepackage{courier}% for a font which looks like Courier (typewriter/monospaced)
%\usepackage{tgcursor}% an altternative
\usepackage{float} % allow floating environments such as figures
\usepackage{amsmath} % math eqn formatting
\usepackage{amssymb} % math fonts
\usepackage[top=33mm, bottom=38mm, left=26mm, right=20mm]{geometry} % page layout
\setlength{\parindent}{5ex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% TITLE PAGE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{title here}
\author{author details}
\date{\today}
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% START OF REPORT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
This will not use Times New Roman itself as that is not included in TeX Live, being a commercial font, but standard substitutions will be used. The commented lines are alternative substitute fonts from the TeX Gyre family. See which you prefer or which look most like TNR to you.
If you have TNR itself, you can use it if you wish. However, you must either use XeLaTeX/LuaLaTeX rather than (pdf)LaTeX, or you must find or generate suitable support files for it. Moreover, the latter is only really an option if you have the font in type1 format or, for pdfLaTeX, truetype format or the licence permits conversion. It you want to know how to generate support files, let me know. I'm assuming there's no reason to in this case since the rules explicitly permit substitution.
The paragraph indentation is trickier. What, you wonder, do they mean by 'space'? This is not obvious in TeX. If they mean the space between words, that is not fixed but varies to get good line breaks etc. Setting it to 5ex
seems not entirely unreasonable. This is equivalent to 5 times the nominal width of the letter 'x'. This 'looks about right' to me but see what you think.
Note that it is recommended to specify american
or british
or whatever for babel
rather than english
because different versions default to different options. You might also pass this to the class so that any package which can use the option will get it.
Seems I nailed it, after finding this about typesetting in algorithm2e and this about the default math mode font.
\newcommand{\myargfont}{\itshape\fontfamily{lmr}\selectfont}
\SetDataSty{myargfont}
I'm not completely sure about the font (as the link talks about Latin Modern Math and not Latin Modern Roman, as I'm using here), so if some one wants to correct me, please do!
Complete code:
\documentclass[10pt,a4paper,twoside]{report}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\DontPrintSemicolon
\newcommand{\myargfont}{\itshape\fontfamily{lmr}\selectfont}
\SetDataSty{myargfont}
\SetKwData{Result}{result}
% Use Arial font as default
%
\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}
\begin{document}
\begin{algorithm}
\KwIn{\(x\) and \(y\)}
\KwOut{\Result}
\(\Result\leftarrow x + y\) \;
\Return{\Result}
\caption{ This is a caption }
\end{algorithm}
In here I talk about the \Result of \(x + y\).
\end{document}
Best Answer
Here’s a list of some fonts:
\mathcal
requireseucal
package\mathbb
requiresamsfonts
package\mathscr
requiresmathrsfs
package\mathtt
is misisng in the imageBut I strongly recommend not to use them directly but instead define a new markup macro like
and then use it like
(shorter names are certainly possible, like
\stsp{X}
)Doing this would be in the sense of TeX’s separation of content/structure and design/layout, i.e. logical markup instead of fixed formatting. Furthermore in this case it is easy to change the appearance later constant win the whole document, for example if your editor/publisher wants another style.
If you got only latin letters (or a text font supporting greek) you could use the text font for this and define
(I added also
\itshape
because usually variable are set in italics.)Another way is to define a new math alphabet: Bold , italic (and sans-serif) math symbols
First, a note: It should be
$\myvar{X}_{test}$
(the subscript outside of the variable argument). Furthermore If the subscript is a text like “max”, “eff.”, “min” etc. you should use\text
fromamsmath
package! Only if the subscript is a variable itself (n, i, …) or a number you should write it likex_i
.If the subscript is always the same (text) you could just add it to the above definition:
(The
\mkern2mu
part insert a little space to shift the subscript a little to the right, which looks better.)If you always have a subscript but a different one each time you can add a second mandatory argument:
and use it like
$\myvar{X}{test}$
.If the subscript is optional you could use an optional argument which could be defined with
\newcommand
too but the test for an empty argument is easier with\NewDocumentCommand
form thexparse
package:and use it like
$\myvar{X}$
or$\myvar[test]{X}$
. It is also possible to change the order of the arguments by replacingo m
withm o
,#1
with#2
and vice versa. Then the second argument would be optional but it could be problematic if the major without optional argument should be followed by a bracket.