comparison of latex with postscript [closed] - latex

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I came across latex both as a saving format and drawing framework under libreoffice and goffice.
I also came across djvu as an alternative to pdf, which uses latex instead of postscript.
Now, postscript is adobe's base for flash animations, and is thus vector graphics tagged under a script.
So for me, latex looks like an alternative to postscript. Or can latex substitute postscript?

Postscript is a scripted programming language with built-in graphics and font-rendering primitives. It can be used as a word-processor's output format, but usually requires to word-processor to do all the text-placement calculations. Output can be post-processed to PDF.
TeX (I'll get to LaTeX in a moment) is a document-processing language. It performs text-placement calculations and font-rendering but lacks the drawing facilities of postscript. TeX output is normally a .dvi (device-independent document) file which can be post-processed into postscript.
LaTeX basically adds style-sheets to TeX, higher-level concepts like "chapter" and "section".
So you end up with a chain. LaTeX -> TeX -> DVI -> PS -> PDF (mirroring the earlier chain: pic | eqn | tbl | groff). Later versions of LaTeX have merged several of these conversions. DVI, PS, and PDF are all equally good, but you may prefer one to the others depending on what other software you wish to use. There's a popular package for LaTeX called PSTricks which requires you to have PS in the chain.
So they're all different, but the same, you know?
It may be helpful to enumerate which of these formats cannot be converted into one of the others.
LaTeX -> TeX. You cannot really go the other way. I'm not sure it makes any sense.
TeX -> DVI. Again, this is a "rendering" step, so you can't go backwards. Like you can't convert a photograph of an apple into an apple.
DVI -> PS. PS -> DVI. DVI -> PDF. PDF -> DVI (never heard of this, but why not?!). PS -> PDF. PDF -> PS (unless you're using PDF layers which don't exist in PS). These three, treated as output formats are readily inter-convertible.
As input formats, LaTeX, TeX, and PS have very different problem-domains. While theoretically each has the power to perform the proper work of one of the others, it'd be a gaudawful mess. For examples, look up "Line-breaking in Postscript" (you end-up having to re-implement a whole mess of algorithms for which library versions would be readily available in almost any other language) or "Image-Processing in Tex" (you make a "font" of halftone spots and then "print" your image by setting text in that font). DVI and PDF are not really human-read/write-able; they are only "output" formats (except, of course, to post-processing software, to whom they are "input").

LaTeX is a language for easily writing documents, and Postscript is like PDF, so both aren't comparable. latex produces postscript documents. think it like LaTeX is C source code, and postscript the executable produced by compilation.

Related

How can I open a .tex file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 months ago.
The community reviewed whether to reopen this question 8 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I'm trying to open a .tex file.
I'm not sure I've got to the bottom of the (possibly) surprisingly complex process. I was told I could do it with Notepad++, which I proceeded to download. Here is the result:
%sample file for Modelica 2011 Conference paper
\documentclass[11pt,a4paper,twocolumn]{article}
\usepackage{graphicx}
% uncomment according to your operating system:
% ------------------------------------------------
\usepackage[latin1]{inputenc} %% european characters can be used (Windows, old Linux)
%\usepackage[utf8]{inputenc} %% european characters can be used (Linux)
%\usepackage[applemac]{inputenc} %% european characters can be used (Mac OS)
% ------------------------------------------------
\usepackage[T1]{fontenc} %% get hyphenation and accented letters right
\usepackage{mathptmx} %% use fitting times fonts also in formulas
% do not change these lines:
\pagestyle{empty} %% no page numbers!
\usepackage{geometry} %% please don't change geometry settings!
\geometry{left=20mm, right=20mm, top=25mm, bottom=25mm, noheadfoot}
% begin the document
\begin{document}
\thispagestyle{empty}
\title{\textbf{Implementation of a Modelica Library\\
for Simulation of Refrigeration Systems}}
\author{Torge Pfafferott \quad Gerhard Schmitz\\
Technical University Hamburg-Harburg, Department of Technical Thermodynamics\\
Denickestr. 17, 21075 Hamburg}
\date{} % <--- leave date empty
\maketitle\thispagestyle{empty} %% <-- you need this for the first page
\abstract{
The physical modelling and transient simulation of
refrigeration systems can be useful within the specification,
development, integration and optimisation.
Therefore, a model library for vapour compression cycles has been implemented.
The library is based on the free Modelica library ThermoFluid and contains basic correlations for
heat and mass transfer and pressure drop, partial components for control volumes and
flow resistances and advanced ready-to-use models for all relevant
components of refrigeration systems like pipes, heat exchangers,
compressor, expansion devices and accumulator.
}
\emph{Keywords: refrigeration; compression cycle; simulation; thermofluid; CO2; R134a}
\section{Introduction}
The modeling and simulation of refrigeration systems is of interest
for several problems:
\section{Library for refrigeration systems}
The aim of the modelling is to implement a library with physical based
models of components of refrigeration systems. At the moment the
library enables investigations with two refrigerants (CO$_2$, R134a). But
the realised structure allows the extension of the library by other
refrigerants.
\subsection{ThermoFluid library}
The implemented refrigeration library is based on the free Modelica library ThermoFluid
\cite{eborn}, \cite{tum}, \cite{thermofluid}. The
ThermoFluid library, especially its base classes and partial
components, offers a good base for the modelling of refrigeration systems with
respect to the implementation of the three balance equations and the
method of discretisation.
\section{Transient simulation of a CO$_2$-system}
In the following, results of the transient simulation of the above mentioned CO$_2$-system are presented.
The results are compared with data of a start up of the
system and following step changes in compressor speed as shown in
Figure \ref{fig5}.
\begin{figure}[h]
%uncomment next line to include a graphic file
%\centerline{\includegraphics[width=6cm, angle=-90]{fig5.eps}}
%and comment out next line
\centerline{\framebox[6cm]{\rule{0cm}{3.5cm} figure example}}
\caption{Step changes in compressor speed and run of air inlet
temperature at the evaporator in the experiment; set as boundary
condition of simulation run}
\label{fig5}
\end{figure}
\begin{thebibliography}{00}
\addcontentsline{toc}{chapter}{References}
\bibitem{eborn} Eborn J. On Model Libraries for Thermo-hydraulic
Applications. Lund, Sweden: PhD thesis, Department of Automatic
control, Lund Institute of Technology, 2001.
\bibitem{tum}Tummescheit H. Design and Implementation of Object-Oriented Model Libraries
using Modelica. Lund, Sweden: PhD thesis, Department of Automatic
control, Lund Institute of Technology, 2002.
\bibitem{thermofluid} Tummescheit H, Eborn J. Chemical Reaction
Modeling with ThermoFluid/MF and MultiFlash. In: Proceedings of the 2th
Modelica Conference 2002, Oberpfaffenhofen, Germany, Modelica
Association, 18-19 March 2002.
\end{thebibliography}
\end{document}
It seems to me this is not the correct way to view the document. Can someone please let me know whether or not I'm right, and if so, how I can view the document properly?
A .tex file should be a LaTeX source file.
If this is the case, that file contains the source code for a LaTeX document. You can open it with any text editor (notepad, notepad++ should work) and you can view the source code. But if you want to view the final formatted document, you need to install a LaTeX distribution and compile the .tex file.
Of course, any program can write any file with any extension, so if this is not a LaTeX document, then we can't know what software you need to install to open it. Maybe if you upload the file somewhere and link it in your question we can see the file and provide more help to you.
Yes, this is the source code of a LaTeX document. If you were able to paste it here, then you are already viewing it. If you want to view the compiled document, you need to install a LaTeX distribution. You can try to install MiKTeX then you can use that to compile the document to a .pdf file.
You can also check out this question and answer for how to do it: How to compile a LaTeX document?
Also, there's an online LaTeX editor and you can paste your code in there to preview the document: https://www.overleaf.com/.
You can either use Notepad++ or Notepad (provided by MS) to view the source code of.tex file. But, if you want to see the entire document in compiled form use "MikeTeX"
I don't know what the .tex extension on your file means. If we are saying that it is any file with any extension you have several methods of reading it.
I have to assume you are using windows because you have mentioned notepad++.
Use notepad++.
Right click on the file and choose "edit with notepad++"
Use notepad
Change the filename extension to .txt and double click the file.
Use command prompt.
Open the folder that your file is in.
Hold down shift and right click. (not on the file, but in the folder that the file is in.)
Choose "open command window here"
from the command prompt type: "type filename.tex"
If these don't work, I would need more detail as to how they are not working. Errors that you may be getting or what you may expect to be in the file might help.

Tools for converting LaTeX equations to Content MathML or OpenMath?

Do you know any open source tools or libraries (preferably Java, but that's not a strict requirement) in the GNU/Linux world that convert mathematical equations in LaTeX syntax to Content MathML or OpenMath?
I need to convert tons of equations in batch mode, so I'm not looking for interactive apps.
EDIT My focus is on the equations' semantics, so I cannot use Presentation MathML (unless there's a converter from Presentation MathML to Content MathML).
Thanks in advance!
This might be what you are looking for: SnuggleTeX
From the site:
SnuggleTeX is a 100% Java library for converting (a reasonable subset of) LaTeX into XHTML + MathML.
SnuggleTeX can attempt to convert input LaTeX to Content MathML by first creating Enhanced Presentation MathML and then processing that. In many ways, this part of the process is relatively simple since most of the semantic structure has already been inferred (though might not necessarily make any sense).
You can also use an online equation editor WIRIS editor which is able to import MathML/Latex and export to MathML/Latex
Have a look over here, where you can find a perl version.
You may want to have a look at LaTeXML. It converts LaTeX to various XML formats, including OpenMath and content MathML.
But be warned, like all other tools, the conversion from (presentation-oriented) LaTeX to content markup (as in OpenMath and MathML) is heuristic. In particular, in ambiguous situations (e.g. $f(a+b)$, which can mean $f$ applied to $(a+b)$ or $f$ times $(a+b)$) LaTeXML chooses one (usually times).
There are two ways out:
1) use content markup already in the LaTeX source (see http://trac.kwarc.info/sTeX)
2) use a better post-processor for LaTeXML is working on this

include figure files in latex [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I am trying to include jpeg files in latex
\includegraphics[width=57.6mm, height=43.2mm]{../../results2/html/zerooneloss_stumps.jpg}
With specified the width and height and compiled with pdflatex, however, it produces the error:
! LaTeX Error: Cannot determine size of graphic in ../../results2/html/zerooneloss_stumps.jpg (no BoundingBox).
The true size of the image is 576x432 in pixels. Have I specified the size correctly in the latex file?
Anyway to use the default setting without need to specify the width and height? If I don't specify the them in the latex file,
\includegraphics[]{../../results2/html/zerooneloss_stumps.jpg}
I still get the same no BoundingBox error.
Thanks and regards!
Change
\includegraphics[]{../../results2/html/zerooneloss_stumps.jpg}
to
\includegraphics{../../results2/html/zerooneloss_stumps.jpg}
still has the no BoundingBox error.
I am using
\usepackage[dvips]{graphicx}
What is the difference between it and
\usepackage{graphicx}
It seems with the former one, eps figure files can work while jpeg files cannot, with the latter, things become reverse?
Is it possiblt to include figure files of both eps and jpg in the same latex file?
Do you have \usepackage{graphicx} in your preamble?
EDIT (consequent of an edit in the question): you should not use the dvips option when using pdflatex. The option produces informations useful for the postprocessing of the dvi output of the latex program (e.g. via dvips). In you case, since you are using pdflatex you should simply not give any option to the graphicx package (the right driver is choosen automatically). On the other hand pdflatex only supports external graphics in PNG, JPG or PDF format, but, as other have said, it's easy to convert EPS to PDF: my preferred way is to use epstopdf that in Ubuntu is provided by the texlive-extra-utils package.
For example, when processed with pdflatex, the following example works if you have a file image.png or image.jpg or image.pdf in the current directory:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{image}
\end{document}
You have to add the package option pdftex to the package graphicx:
\usepackage[pdftex]{graphicx}
try \includegraphics{myfig.jpg}
when you say [width=57.6mm, height=43.2mm] it's the box size in millimeters (mm). latex scales your image to this dimension.
more scale options: http://amath.colorado.edu/documentation/LaTeX/reference/figures.html
For the no Bounding Box error:
What's a BoundingBox?
A BoundingBox is a entry that is located in PostScript files that tells the reader the scale limits of the file. Latex uses this entry to determine how to place the image in the document.
How to fix my Latex problem
It is quite easy to fix this problem. The software package ImageMagick is used in this case to convert the images from one form to another. ImageMagick is able to convert many image formats to many other types. To do the conversion just enter this into your console:
root#Pingu ~ # convert image.jpg image.eps
http://www.tuxpages.com/helppages/latex-convert.shtml

LaTeX font in Postscript document

I am starting off with Postscript, and would like to do something very simple: include a LaTeX symbol within my Postscript document. For example:
%!
/FontSize 12 def
newpath
0 0 moveto
("Hello \LaTeX") show % This is where I would like
% the rendering of \LaTeX
% with actual LaTeX font
showpage
Any ideas?
The \LaTeX logo is just normal letters moved slightly around via kerning. So if you're already hacking raw postscript commands, you should just copy the dimensions from the definition in latex.ltx and issue the same movement commands between the letters in postscript. Ditto to select the CM font, or whatever you would like.
If the aim is to mix together Postscript and Latex in one document, you can use Metapost. Hans Hagen's Metafun manual is the best introduction to Metapost I know of, although note that:
He assumes that you will be using Tex or Context and not Latex. If you want to use Latex macros in Metapost, you will need some additional boilerplate;
Metafun is a slight superset of regular Metapost; and
He more or less ignores the ability of Metapost to embed raw Postscript — the core of the Metapost language is an extension of Knuth's Metafont, and is quite unlike Postscript.
Cf. also Troy Henderson's Embedding fonts in MetaPost output, which explains how to embed Tex fonts in the Postscript files generated by Metapost.

Different encoding of latex and bibtex files [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Does LaTeX handle situation when a .bib file has different encoding than .tex file? For instance, .tex is in ISO-8859-2 and .bib in UTF-8. Can the encoding be converted on the fly by LaTeX? Or the only way is to do is manually?
First of all, according to the LyX wiki BibTeX can't use UTF-8:
BibTeX does not support files encoded in UTF-8 (i.e., Unicode), which is nowadays the default file encoding on most OSes. The reason is that current BibTeX (v. 0.99c) was released in 1988 and thus predates the advent of unicode. Unless the long-announced BibTeX v. 1.0 or one of the many planned potential successing applications are ready, latin1 (ISO-8859-1) or another 8-bit encoding has to be used for the bib file (this does not affect the LaTeX encoding, which still can be utf8).
Usually, whatever is inside a BibTeX file gets copied verbatim to the LaTeX source code (with some formatting maybe and case changings, &c.), such as book titles, authors, &c.
So your BibTeX file encoding has to match the one used by your LaTeX file, otherwise things get funny. You also can't use babel-provided commands in BibTeX (such as "a for ä, provided by n?german) unless your document includes the right packages.
The canonical way is to make BibTeX files agnostic of any encoding or package issues by always specifying special characters with their appropriate commands.
This basically means that instead of writing ä you would have to use {\" a} if you want to be absolutely sure that it works. Seems to be fairly standard practice.
The BibTeX manual BibTeXing by Oren Patashnik also details this:
BibTeX now handles accented
characters. For example if you have an
entry with the two fields
author = "Kurt G{\"o}del",
year = 1931,
and if you're using the alpha
bibliography style, then BibTeX will
construct the label [Göd31] for this
entry, which is what you'd want. To
get this feature to work you must
place the entire accented character in
braces; in this case either {\"o} or
{\"{o}} will do. Furthermore these
braces must not themselves be enclosed
in braces (other than the ones that
might delimit the entire field or the
entire entry); and there must be a
backslash as the very first character
inside the braces. Thus neither
{G{\"{o}}del} nor {G\"{o}del} will
work for this example. This feature
handles all the accented characters
and all but the nonbackslashed foreign
symbols found in Tables 3.1 and 3.2 of
the LaTeX book. This feature behaves
similarly for "accents" you might
define; we'll see an example shortly.
For the purposes of counting letters
in labels, BibTeX considers everything
contained inside the braces as a
single letter.
You can change the input encoding on the fly:
\inputencoding{latin2}
\bibliography{mybib}
\inputencoding{utf8}
The \inputencoding command is provided by the inputenc package.
BibTeX has huge problems with non-ASCII characters, even in the newest version. If you prefer a modern system, I'd like to recommend the combination of biblatex and biber. Both are still in beta stage, but they work quite well even in production environments. With this combination, most problems related to LaTeX bibliographies will vanish. As a side note, the biblatex documentation also contains a section about encoding issues with traditional BibTeX (§ 2.4.3).
Bibtex has random support for any non-standard character encodings -- essentially sometimes it works, most of the time it doesn't and officially it is not supported (More details ).
Personally, in .bib, I stick to the basic ASCII and LaTeX magic like \"o. For .tex, if I don't write in English, I keep .tex in UTF-8 with \usepackage[utf8]{inputenc} .

Resources