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

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.

Related

What are the advantages and disadvantages of creating figures with the tikZ/pgfplots packages rather than directly with Matlab?

I'm using Matlab to get figures from data produced with Fortran calculations and I was wondering if it's better to produce them directly with Matlab (I use the .pdf format) or export them with Matlab2tikz and then process them with the tikZ/pgfplots packages directly on overleaf. Of course I need a very good graphical output and the overleaf compilation to be fast.
A solution that allows both perfect graphical output and fast compilation is to export your graph with Matlab2tikz, compile it separately in a standalone documentclass, like this:
\documentclass{standalone}
...
\begin{document}
\begin{tikzpicture}
...
\end{tikzpicture}
\end{document}
and then include the resulting .pdf in your main document with:
\includegraphics{mygraph.pdf}
You don't have to compile your main document twice for this, of course you have to compile the standalone document before.
As samcarter already said in their comment, the advantage of having TikZ is that you can have the same fonts as the rest of your document. So your document will look high-quality.
The disadvantage is that compilation time gets longer if you have a lot of TikZ pictures and compile them directly in your document.

How can I use org-mode to write LaTeX for scientific journals?

I write most text using org-mode nowadays, and I often use it to generate PDF via LaTeX (xelatex, specifcally). But now I want to use it to write scientific articles, and journals often want me to use a specific style. This includes a .cls-file, which is easy enough using org-latex-classes, but quite often, they require a specific setup following \begin{document} (i.e. a specific abstract section, funky author and affiliation, etc, and I don't see how to do that. That is, I now do this within a #+begin/end_latex section - but this needs to be completely rewritten if I switch style.
I realize I probably need to fiddle with the LaTeX code at some point, but I'd like to minimize this fiddling as far as possible, and I'd like to be able to switch from one journal to another with a minimum of fuss, and keeping my org-mode source as intact as possible.
See item 3 at http://kitchingroup.cheme.cmu.edu/blog/2014/08/08/What-we-are-using-org-mode-for/
There is a list of papers there we have written in org-mode and exported to LaTeX. We have probably 8 more since that post.
In the SI you can find the org-source embedded in the PDF, and here: Spencer D. Miller, Vladimir V. Pushkarev, Andrew J. Gellman and John R. Kitchin, Simulating Temperature Programmed Desorption of Oxygen on Pt(111) Using DFT Derived Coverage Dependent Desorption Barriers, Topics In Catalysis, 57(1), 106-117 (2013). http://link.springer.com/article/10.1007%2Fs11244-013-0166-3 you can even find our manuscript embedded.
You may also want to checkout https://github.com/jkitchin/org-ref for citation management and https://github.com/jkitchin/jmax/blob/master/ox-manuscript.el for how we do our exports.
Depending on the amount of latex polishing you need to do, you may find it simpler to just add some things to your org file, and use a little bit of babel directly. Here is a snippet of how the start of one my files might look. Some of things are in there, because I will also have the R code for the statistical analyses in the org file in order to be able to have a more reproducible work flow:
# -*- mode: org; org-export-babel-evaluate: nil -*-
#+Title: This is my title
#+Author: An Author, Another Author, and Last Author
#+Options: toc:nil ':t *:nil -:nil ::nil <:nil ^:t author:t d:t H:5 |:t
#+Property: header-args:R :session *myarticlessection* :results output :exports both :cache yes
#+Latex_Class: article
#+Latex_Class_Options: [12pt]
#+Latex_Header: \usepackage{amsmath}
#+Latex_Header: \usepackage[T1]{fontenc}
#+Latex_Header: \usepackage{mathptmx}
#+Latex_Header_Extra: \linespread{1.5}
#+LATEX_HEADER: \usepackage[citestyle=authoryear-icomp,bibstyle=authoryear, hyperref=true,backref=true,maxcitenames=3,url=true,backend=biber,natbib=true] {biblatex}
#+Latex_header: \addbibresource{myarticles.bib}
#+BEGIN_SRC latex :results output
\begin{abstract}
Here is where I put the abstract.
\end{abstract}
#+END_SRC
#+RESULTS:
#+BEGIN_LaTeX
\begin{abstract}
And this is where it ended up after evaluating the babel block.
\end{abstract}
#+END_LaTeX
I used org-mode to write several papers, including my PhD thesis. It helped me greatly to keep track of open problems, priorities, annotations etc.
I use a small custom converter that reads the .org file and exports parts of it to a .tex file. Note that "normal" org-mode text (including headings, text, priorities, keywords etc.) is not exported, just the stuff between #BEGIN_LaTeX and #END_LaTeX tags. This way, you can make annotations as you see fit, which won't appear in the published text.

comparison of latex with postscript [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
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.

Latex, TikZ and separate compilation of chapters and figures

I have fairly large Latex document with a lot of TikZ figures inside. I have a habit of frequent recompilation and it takes forever to compile it using pdflatex. Figures in TikZ take most of the time.
My question is what is the best way to split the document into separate tex files (figures/chapters) to achieve separate compilation of figures and chapters, separate chapter pdfs, and a whole document pdf file ?
Have you tried compiling each picture on its own and then including them in your tex file as pdf rather than the tikz code? You can use the package standalone so that the picture will be the exact size you need. So :
\documentclass{standalone}
\usepackage{tikz,pgf} %and any other packages or tikzlibraries your picture needs
\begin{document}
\begin{tikzpicture}
%your tikz code here
\end{tikzpicture}
\end{document}
The good thing about this is that you can either include the compile this document directly to get a pdf figure to include in your document, or you can use the command \input to include it in your main document as a tikz code by adding
\usepackage{standalone}
in your main document (together with the tikz packages and libraries), and then
\begin{figure}
\input{tikzfile.tex}
\end{figure}
There is a possibly better way (imho) to cache tikz-pictures. Add the following lines in your
preamble:
\usetikzlibrary{external}
\tikzexternalize[prefix=i/]
After a pdflatex-run you'll see all pictures in the subdirectory ./i .
If you update the code of a tikz-picture simply throw away its corresponding pdf-file and it will be regenerated. For more info see the manual of PFG/TikZ section 32.4 Externalizing Graphics
and possibly 32.5 Using External Graphics Without pgf Installed.
How about putting each chapter in a separate file and then using \include to put them into some master file? Then you can use \includeonly to only compile the chapter you're currently working on. That should save some time at least.
I expect some sort of makefile based solution would be even better than this, but I don't know anything about makefiles...
The way I generally do this is to apply Latex to just part of the file: Emacs and several other Latex editors allow you to compiler regions: with Auctex, you can run TeX-pin-region to specify the current chapter, and then TeX-command-region to run Latex on the selected region.
The traditional way to do this is cut parts of the big file into smaller parts that are \included, and then either comment out parts you don't want to work on, or put some macrology at the beginning and end of each file that allows them to be compiled separately.

Example for a simple LaTeX glossary

I'm trying to include a simple glossary to my LaTeX document,
I already searched for something like that on google, but never got it running.
I would like to use glossary or glossaries.
how to write it in the text?
how to print it?
what to execute on which position?
Well, there is a glossaries package on CTAN. Read the pdf documentation.
Check if you already have it in your installation, if not install it, and put \usepackage{glossaries} in the preamble of you document and it will be available to you.
It looks like you need \usepackage{glossaries} and \makeglossaries in the preamble, and some number of \newglossaryentry and \newacronym calls (it is not immediately clear to me if these only go in the premble or can go in the document text). Finally, you will need one or more \printglossary calls in the text. Use \gsl to connect glossary entries on the argument with the pages they occur on.
Processing the file will have to include a call to makeglossaries followed by at least one more invokation of latex.
In addition to the samples mentioned in the documentation there is a Stack Overflow question which includes a minimal file making use of glossaries. You may be particularly interested in the acronym glossary.
There is a nice blog for beginners: LaTeX glossary and list of acronyms
Here is an example:
\documentclass{article}
% Load the package
\usepackage{glossaries}
% Generate the glossary
**\makeglossaries**
\begin{document}
%Term definitions
\newglossaryentry{utc}{name=UTC, description={Coordinated Universal Time}}
\newglossaryentry{adt}{name=ADT, description={Atlantic Daylight Time}}
\newglossaryentry{est}{name=EST, description={Eastern Standard Time}}
% Use the terms
\gls{utc} is 3 hours behind \gls{adt} and 10 hours ahead of \gls{est}.
%Print the glossary
\printglossaries
\end{document}

Resources