Register to reply

Times New Roman font in Latex

by S_David
Tags: font, latex, roman, times
Share this thread:
S_David
#1
Nov20-12, 12:35 PM
P: 599
Hello,

I need to change the font in my latex file to Times New Roman, and I used this in the preamble to do that:

\usepackage{fontspec}
\setmainfont{Times New Roman}
but I get errors in compilation from PS->PDF. Why? Is there any other way? I need this compilation from PS->PDF for some figures to appear correctly.

Thanks
Phys.Org News Partner Science news on Phys.org
Scientists develop 'electronic nose' for rapid detection of C. diff infection
Why plants in the office make us more productive
Tesla Motors dealing as states play factory poker
Simon Bridge
#2
Nov20-12, 06:19 PM
Homework
Sci Advisor
HW Helper
Thanks
Simon Bridge's Avatar
P: 12,958
How are you doing the compilation and what are the errors?
S_David
#3
Nov20-12, 09:24 PM
P: 599
Quote Quote by Simon Bridge View Post
How are you doing the compilation and what are the errors?
Latex->PS->PDF. There are 10 errors. They are not in front of me now.

Simon Bridge
#4
Nov21-12, 12:54 AM
Homework
Sci Advisor
HW Helper
Thanks
Simon Bridge's Avatar
P: 12,958
Times New Roman font in Latex

In order to turn a .tex file into a .ps file, you had to use a computer program - there are lots that do this: which one did you use. Likewise for doing the .ps to a .pdf.

You can turn a .tex directly into pdf using the program "pdflatex" for example, or from ps to pdf using "ps2pdf".

The errors are important for figuring out what went wrong.
i.e. perhaps the font does not have some of the characters you are trying to use - the errors will tell you that.
S_David
#5
Nov21-12, 10:33 AM
P: 599
Quote Quote by Simon Bridge View Post
In order to turn a .tex file into a .ps file, you had to use a computer program - there are lots that do this: which one did you use. Likewise for doing the .ps to a .pdf.

You can turn a .tex directly into pdf using the program "pdflatex" for example, or from ps to pdf using "ps2pdf".

The errors are important for figuring out what went wrong.
i.e. perhaps the font does not have some of the characters you are trying to use - the errors will tell you that.
No I need to go from PS to PDF as I have tikz figures. Anyway, I have done it using XeLatex and it works now. Thanks
Simon Bridge
#6
Nov21-12, 10:50 PM
Homework
Sci Advisor
HW Helper
Thanks
Simon Bridge's Avatar
P: 12,958
Yep, XeLatex bundles the stuff commonly needed and has good online support.
I still use CLI latex and pdflatex with a text editor. For anything besides pdf I'd export to dvi but tiks figures won't do that will they?

Of course you could have imported the ps using Adobe Acrobat ... but you may be using Linux or only free/gratis software. In future - remember that this sort of question is meaningless without the names of the software used and the exact error messages (copy and paste).
AlephZero
#7
Nov22-12, 08:16 AM
Engineering
Sci Advisor
HW Helper
Thanks
P: 7,172
Quote Quote by S_David View Post
Anyway, I have done it using XeLatex and it works now.
That figures, because XeTeX handles fonts in a completely different way from older versions of TeX. Earlier versions wouldn't understand
\sepackage{fontspec}
\setmainfont{Times New Roman}
Of course there is a way to use Times Roman in earlier versions of TeX, but if your document was meant to be processed by XeTeX, changing that might only be the first of a long list of compatibility issues!
S_David
#8
Nov22-12, 12:08 PM
P: 599
Quote Quote by Simon Bridge View Post
Yep, XeLatex bundles the stuff commonly needed and has good online support.
I still use CLI latex and pdflatex with a text editor. For anything besides pdf I'd export to dvi but tiks figures won't do that will they?

Of course you could have imported the ps using Adobe Acrobat ... but you may be using Linux or only free/gratis software. In future - remember that this sort of question is meaningless without the names of the software used and the exact error messages (copy and paste).
OK, I will remember that. I am using TeXnicCenter. Thanks

Yet there is another problem, which is that my document is now written in two fonts after using the above package: Not all my document appear the same. Some fonts are the default (which is bright), and some fonts are Times New Roman (which is dark). Why?
AlephZero
#9
Nov22-12, 12:32 PM
Engineering
Sci Advisor
HW Helper
Thanks
P: 7,172
If you make a SMALL document that shows the problem and attach it, somebody might be able to help.

Otherwise, we are just guessing. You haven't told us anything about what you did except "it didn't work".
S_David
#10
Nov22-12, 12:49 PM
P: 599
Quote Quote by AlephZero View Post
If you make a SMALL document that shows the problem and attach it, somebody might be able to help.

Otherwise, we are just guessing. You haven't told us anything about what you did except "it didn't work".
Here are two consecutive pages, where it appears to me that the first one is not Times New Roman, but the second one is.

Thanks
Attached Files
File Type: pdf Pages from Proposal.pdf (112.6 KB, 19 views)
AlephZero
#11
Nov22-12, 05:14 PM
Engineering
Sci Advisor
HW Helper
Thanks
P: 7,172
When I said "attach the file" I meant the tex input file, not just the output, so anybody who is interested enough can play around with it in their version of TeX.

I'm not convinced you have two different fonts. I can see what you describe when I look at the PDF with Adobe Reader 11, but when I zoomed in on the same word on pages 1 and 2, made two screen dumps, and pasted them side by side, I can't see any difference at all. (Open the attachment in a separate window to see it "full size").

Using "properties" in Adobe reader the only fonts in the PDF are Times Roman, Times Roman Bold (probably used for the headings) and a lot of the Computer Modern fonts for the math. Computer Modern text fonts don't look anything like Times Roman, so can't be one of those.

This is probably some weird artefact of way the the PDF viewer is rendering the font, not a TeX problem. It's possible you have done something (e.g. when creating the figure?) that changed the "weight" (i.e. blackness) of the font slightly, and didn't change it back again. Try deleting the figure and see if that gets rid of the problem.
Attached Thumbnails
the.png  
S_David
#12
Nov22-12, 06:40 PM
P: 599
I tried to do the same as in my document, but the result was not the same:

\documentclass[a4paper,oneside,12pt]{report}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes,arrows,fadings, shadows}
\usepackage{fontspec}
\setmainfont{Times New Roman}

\begin{document}


A major design parameter here is the accuracy of the factor $a$, and the residual Doppler the tolerated by an adaptive equalizer, where a residual Doppler of the order $10^{-4}$ is needed to a ... equalizer to track the changes, otherwise, it diverge .... In ... it was shown that the preprocessing resampling converts the wide-band signal to a narrow-band signal, where ... can be used to eliminate the residual Doppler effect resulting from the estimation error of the factor $a$. 

\tikzstyle{block} = [draw, top color=blue!40,
      bottom color=blue!5, rectangle, minimum height=3em, minimum width=6em, shade, rounded corners,drop shadow]
\tikzstyle{sum} = [draw, top color=blue!40, bottom color=blue!5, circle, node distance=1cm, shade,drop shadow]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]



\begin{figure}[h!]
\begin{center}
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
%\begin{tikzpicture}[scale = 0.6]
    % We start by placing the blocks
    \node [input, name=input] {};
		
		
    
    \node [block, right of=input,node distance=3cm] (Map) {Mapping};
    \node [block, right of=Map,
            node distance=4cm] (IDFT) {IDFT \& $+$CP};
		\node [block, right of=IDFT,
            node distance=4cm] (ch) {$\{h_l\}$};
		\node [block, below of=ch,
            node distance=3cm] (DFT) {-CP \&  DFT};
		\node [output, right of=ch,node distance=3cm] (output1) {};
		\node [sum, below of=output1,node distance=1.5cm] (sum) {$\Sigma$};
		\node [block, left of=DFT,
            node distance=4cm] (FDE) {FDE};
		\node [block, left of=FDE,
            node distance=4cm] (Dec) {Detection};
		\node [output, left of=Dec,node distance=3cm] (output2) {};
		\node [input, right of=sum,node distance=2cm] (input2) {};
		%\node [output, name=output, right of=IDFT] {};
    % We draw an edge between the controller and system block to 
    % calculate the coordinate u. We need it to place the measurement block. 
    %\draw [->] (controller) -- node[name=u] {$u$} (system);
    
    %\node [block, below of=u] (measurements) {Measurements};
%
    %% Once the nodes are placed, connecting them is easy. 
    \draw [draw,->] (input) -- node {$\{b_k\}$} (Map);
		\draw [draw,->] (Map) -- node {$\{X_k\}$} (IDFT);
		\draw [draw,->] (IDFT) -- node {$\{x_n\}$} (ch);
		\draw [draw,->] (ch) -| node {} (sum);
	  %\draw [draw,->] (sum) -- node {} (output1);
		\draw [draw,->] (sum) |- node [pos=0.8]{$\{y_n\}$} (DFT);
		\draw [draw,->] (DFT) -- node {$\{Y_k\}$} (FDE);
		\draw [draw,->] (FDE) -- node {$\{\tilde{X}_k\}$} (Dec);
		\draw [draw,->] (Dec) -- node {$\{\hat{b}_k\}$} (output2);
		\draw [draw,->] (input2) -- node {$\{z_n\}$} (sum);
    %\draw [->] (sum) -- node {$e$} (controller);
    %\draw [->] (system) -- node [name=y] {$y$}(output);
    %\draw [->] (y) |- (measurements);
    %\draw [->] (measurements) -| node[pos=0.99] {$-$} 
        %node [near end] {$y_m$} (sum);
\end{tikzpicture}
\caption{OFDM block diagram}
\label{Fig:OFDMBD}
\end{center}
\end{figure}

A major design parameter here is the accuracy of the factor $a$, and the residual Doppler the tolerated by an adaptive equalizer, where a residual Doppler of the order $10^{-4}$ is needed to a .. equalizer to track the changes, otherwise, it diverge .... In ... it was shown that the preprocessing resampling converts the wide-band signal to a narrow-band signal, where ... can be used to eliminate the residual Doppler effect resulting from the estimation error of the factor $a$. 
\end{document}
where I separate two paragraphs by a tikz figure, and the tow paragraphs are of the same fonts and darkness, while they are not in my document!!
S_David
#13
Nov22-12, 08:07 PM
P: 599
Quote Quote by AlephZero View Post
When I said "attach the file" I meant the tex input file, not just the output, so anybody who is interested enough can play around with it in their version of TeX.

I'm not convinced you have two different fonts. I can see what you describe when I look at the PDF with Adobe Reader 11, but when I zoomed in on the same word on pages 1 and 2, made two screen dumps, and pasted them side by side, I can't see any difference at all. (Open the attachment in a separate window to see it "full size").

Using "properties" in Adobe reader the only fonts in the PDF are Times Roman, Times Roman Bold (probably used for the headings) and a lot of the Computer Modern fonts for the math. Computer Modern text fonts don't look anything like Times Roman, so can't be one of those.

This is probably some weird artefact of way the the PDF viewer is rendering the font, not a TeX problem. It's possible you have done something (e.g. when creating the figure?) that changed the "weight" (i.e. blackness) of the font slightly, and didn't change it back again. Try deleting the figure and see if that gets rid of the problem.
I deleted the figure, but it is still there!!
AlephZero
#14
Nov22-12, 09:32 PM
Engineering
Sci Advisor
HW Helper
Thanks
P: 7,172
OK, the "good" news is I can reproduce it, but understanding it might take longer (and I don't have much time tomorrow).

It seems to be affecting all the text on the page with the figure on it (both before and after the actual figure). The preceding and following pages all seem to be in the "light" typeface.

IMO that's a "should not happen" situation - it suggests something is incompatible with something else, but it's not at all obvious what.
S_David
#15
Nov22-12, 09:37 PM
P: 599
Quote Quote by AlephZero View Post
OK, the "good" news is I can reproduce it, but understanding it might take longer (and I don't have much time tomorrow).

It seems to be affecting all the text on the page with the figure on it (both before and after the actual figure). The preceding and following pages all seem to be in the "light" typeface.

IMO that's a "should not happen" situation - it suggests something is incompatible with something else, but it's not at all obvious what.
I am home now, tomorrow I will post my preamble. May be I am using some packages that make that effect. Do you thing fade or shadow in the tikz package may have this effect?

Thanks for your help.
AlephZero
#16
Nov23-12, 02:33 PM
Engineering
Sci Advisor
HW Helper
Thanks
P: 7,172
Quote Quote by S_David View Post
Do you thing fade or shadow in the tikz package may have this effect?
Deleting the "drop shadow" option in \tikzstyle{block} and \tikzstyle{sum} seems to fix it. The "shade" option doesn't seem to affect anything apart from the drop shadows so you can probably delete that as well.

FWIW I got a warning in the .log file saying
Package pgf Warning: Your graphic driver pgfsys-xetex.def does not support fadings.

Googling various TeX forums, it seems like the only workround is to make a separate tex file for each figure, create a PDF for each one, then use \includegraphics to merge them into the complete document. You will have to play around with the "bounding box" options of \includedgraphics to crop the images down to their "actual size".

Of course an easier workround is to decide that you don't really need boxes with shadows!
S_David
#17
Nov23-12, 03:15 PM
P: 599
Quote Quote by AlephZero View Post
Deleting the "drop shadow" option in \tikzstyle{block} and \tikzstyle{sum} seems to fix it. The "shade" option doesn't seem to affect anything apart from the drop shadows so you can probably delete that as well.

FWIW I got a warning in the .log file saying
Package pgf Warning: Your graphic driver pgfsys-xetex.def does not support fadings.

Googling various TeX forums, it seems like the only workround is to make a separate tex file for each figure, create a PDF for each one, then use \includegraphics to merge them into the complete document. You will have to play around with the "bounding box" options of \includedgraphics to crop the images down to their "actual size".

Of course an easier workround is to decide that you don't really need boxes with shadows!
When I delete drop shadow the font becomes light, but it should be dark, shouldn't it? The same for another document I have under the same specifications, the font is dark.!!


Register to reply

Related Discussions
LaTeX Font Different from Usual? Forum Feedback & Announcements 3
Bold font in latex Math & Science Software 6
What font does latex use? General Math 6
LaTex font size Forum Feedback & Announcements 2