What could be causing font errors when using Times New Roman in Latex?

  • LaTeX
  • Thread starter EngWiPy
  • Start date
  • Tags
    Font Latex
In summary: 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?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.In summary, you used a computer program to convert a .
  • #1
EngWiPy
1,368
61
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:

Code:
\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
 
Physics news on Phys.org
  • #2
How are you doing the compilation and what are the errors?
 
  • #3
Simon Bridge said:
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.
 
  • #4
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.
 
  • #5
Simon Bridge said:
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
 
  • #6
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).
 
  • #7
S_David said:
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
Code:
\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!
 
  • #8
Simon Bridge said:
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?
 
  • #9
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".
 
  • #10
AlephZero said:
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
 

Attachments

  • Pages from Proposal.pdf
    112.6 KB · Views: 631
  • #11
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.
 

Attachments

  • the.png
    the.png
    2.1 KB · Views: 1,227
  • #12
I tried to do the same as in my document, but the result was not the same:

Code:
\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!
 
  • #13
AlephZero said:
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!
 
  • #14
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.
 
  • #15
AlephZero said:
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.
 
  • #16
S_David said:
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!
 
  • #17
AlephZero said:
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.!
 

What is Times New Roman font in Latex?

Times New Roman is a widely used serif font that was designed by Stanley Morison and Victor Lardent in 1931. It is a popular choice for professional documents due to its readability and classic appearance.

How do I use Times New Roman font in Latex?

To use Times New Roman font in Latex, you can include the following command in your document's preamble:

\usepackage{times}

Can I change the font size of Times New Roman in Latex?

Yes, you can change the font size of Times New Roman in Latex by using the \fontsize{ }{ } command. For example, \fontsize{12}{14}\selectfont will set the font size to 12pt with a line spacing of 14pt.

Is Times New Roman font available in different styles in Latex?

Yes, Times New Roman font is available in different styles in Latex, such as bold, italic, underline, and bold-italic. You can use the \textbf{ } command for bold, \textit{ } command for italic, \underline{ } command for underline, and \textbf{\textit{ }} command for bold-italic.

Can I change the default font of my entire Latex document to Times New Roman?

Yes, you can change the default font of your entire Latex document to Times New Roman by using the following command in your document's preamble:

\renewcommand{\rmdefault}{ptm}

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
297
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
23
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
11K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • Programming and Computer Science
Replies
6
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
41K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
Back
Top