I would like to know whether math mode in TeX, could be used, through the command line, and if so, would the document compile? I don't know the steps to follow to accomplish it, through the prompt in the terminal. By the way, the operating system that I'm using, is Windows. If anyone can help me, I'll be greatly indebted!
-
What do you mean by “using CommandLine”? Please, clarify your question. – Manuel Nov 29 '14 at 09:44
-
@Manuel:Oh I meant to say about command prompt in windows. – justin Nov 29 '14 at 09:45
-
1@justin: To be honest: I am not sure what you mean, too. Do you want to know whether you can compile a .tex-file from the command line when used mathmode in this .tex-file? – albert Nov 29 '14 at 09:49
-
@albert:I meant to say whether we could type math commands for example (dollar)\theta(dollar) in terminal(command prompt) and get the response $\theta$. – justin Dec 01 '14 at 06:19
2 Answers
The TeX engine doesn't care whether its input comes from a text file, or from direct entry at the terminal. Nor does it care whether it is invoked from the command line or by pressing a button in an IDE.
[Ians-MacBook-Pro:~/tex/stackexchange] ianthompson% pdflatex
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=pdflatex)
restricted \write18 enabled.
**\documentclass{article}
entering extended mode
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 78 languages loaded.
*\begin{document}
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/size10.clo))
No file texput.aux.
*\[
*a = b
*\]
*\end{document}
[1{/usr/local/texlive/2014/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./texput.aux)</usr/local/texlive/2014/texmf-dist/fonts/type1/public/amsfonts/c
m/cmmi10.pfb></usr/local/texlive/2014/texmf-dist/fonts/type1/public/amsfonts/cm
/cmr10.pfb>
Output written on texput.pdf (1 page, 15787 bytes).
Transcript written on texput.log.
So the answer is yes (whatever platform you use).
- 43,767
-
i've always understood that it's best to enter
\relaxat the**prompt, though i'm not sure why. (i usually run tex from the command line to test hyphenations; maybe that clouds the picture.) – barbara beeton Nov 29 '14 at 15:06 -
@barbarabeeton in latex you can usually get away with it (as documents normally start with a command) but in plain \relax is helpful as it stops the scan for the filename. If uou just to tex
then type – David Carlisle Nov 29 '14 at 17:46helloit tries to input hello.tex rather than typeset hello -
thanks, @david. (maybe this explanation will help someone else too.) – barbara beeton Nov 29 '14 at 19:00
-
@barbarabeeton:I would like to know as you said about testing hyphenations can we test math commands.For example if I type (dollar)\theta(dollar) can I get $\theta$ as response using tex but without reading the content in a pdf file as explained by Ian Thompson. – justin Dec 01 '14 at 06:23
-
@justin -- i don't understand your question. in order to get any "result" for something that is actually to be typeset, you have to have some sort of output mode, and the only outputs i know of are dvi and pdf. so i think the answer is "no". hyphenations are a special case; everything is reported in the log file as well as on the screen. – barbara beeton Dec 01 '14 at 13:28
-
@barbarabeeton:I'm just asking if you can check whether a math command written in tex or latex is correct by typing it in the command prompt in windows or is it mandatory to write the math command in a input file and convert it to dvi and then pdf and check the result.I think the first choice is better that's why I'm asking this. – justin Dec 01 '14 at 13:35
-
@justin -- yes, that should be possible. however, to do that you must enter either
\relaxor\documentclass{...}at the double**prompt, and follow that with\begin{document}before entering your test code. if you don't get an error message when you type the command you want to check, then you can presume that it "exists". (there's no way to know whether it is what you really want without looking at output though.) personally, i find keeping a "test template" around is less hassle. – barbara beeton Dec 01 '14 at 13:42 -
@barbarabeeton:Thanks.I typed
$\theta$and after that as you said I typed\relaxbut it jumps to the next*prompt after typing enter.Could you help me. – justin Dec 01 '14 at 13:51
this is the transcript of a "successful" attempt to test the \theta command using
command line input. observe that in order to get a system prompt, it's necessary to
enter a complete document if using latex.
> latex
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)
**\documentclass{article}
entering extended mode
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2012-05-30, ngerman-x-2012-05-30, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, friulan, galician, german, ngerman, swissgerman, monogreek, greek, h
ungarian, icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, ma
rathi, oriya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian,
kurmanji, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk,
polish, portuguese, romanian, romansh, russian, sanskrit, serbian, serbianc, s
lovak, slovenian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian,
welsh, loaded.
*\begin{document}
(/ams/texmf/archive/texlive2012/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/ams/texmf/archive/texlive2012/texmf-dist/tex/latex/base/size10.clo))
(./texput.aux)
*$\theta$
*\end{document}
[1] (./texput.aux)
Output written on texput.dvi (1 page, 260 bytes).
Transcript written on texput.log.
>
here is the equivalent transcript using plain tex:
> tex
This is TeX, Version 3.1415926 (TeX Live 2012)
**\relax
*$\theta$
*\bye
[1]
Output written on texput.dvi (1 page, 252 bytes).
Transcript written on texput.log.
>
the plain tex version is also a complete document, ended with \bye.
it's possible to interrupt either tex or latex with a ctrl-c at the * prompt, but
you still need to enter something after an
*! Interruption.
<*>
?
the proper response to that is x to terminate.
really, unless you're an absolutely flawless typist, it's easier to keep a little template around that can be used to test.
- 88,848
-
:That's a good answer.That really worked.Could you tell is there an option to clear the screen(command prompt in windows) like
clsin windows orclearin linux.Also is there any article or website that is good to start using and learning tex as an beginner? – justin Dec 01 '14 at 14:30 -
i'm mostly working on linux, and
ctrl-lclears the screen there, but this may be a local assignment. regarding learning (la)tex as a beginner, you could do worse than check out the references given in the question What are good learning resources for a LaTeX beginner?. the "not so short guide" and nicola talbot's "latex for complete novices" both impress me as accurate and well presented, although i don't wish to downgrade any of the other suggestions. also, search for "beginner" on this site; other questions are more "directed". – barbara beeton Dec 01 '14 at 15:56