tex programming - latex

can some one help m from where and how i will i learn the tex programming
because i have to make package which i will use in miktex

If you are really determined, the book by the original author of TeX itself is a great source: http://www.ctex.org/documents/shredder/src/texbook.pdf . (I wonder if this is a legal copy but found as the first hit on Google.)

Package writing is generally where the most arcane features of the TeX language are most heavily exercised. Writing a package should not be the first thing you do with (La)TeX!
Writing this in 2018, I would suggest that you start with learning XeLaTeX and the fontspec package. That can save you a whole bunch of grief w.r.t. text encodings and fonts.
If you have specific questions, head over to https://tex.stackexchange.com/.

Related

How to change spelling suggestion to en-US in latex + vs code?

I am using VS code + Latex for writing my research papers. I want my spell check to show suggestions in English-US, but the results I am getting are in English-UK. Is there any possible way to configure the language in VS code?
PS: I am using the LaTex Workshop (James Yu) extension in VS code.
There are several VS Code plugins which provide this task. I recommend a couple:
Code Spell Checker, which supports many programming and markup languages;
LTeX – LanguageTool grammar/spell checking, which supports only a few markup languages.
Both check documents in American English (en-US) by default. 

changing the citation style in LateX

I am very new to LaTex so my question may be really naive. I am writing my PhD thesis using this template. The problem is that I need to change the citation style so that it based on author year not numbers as in the template. I tried many times but it always fails with many error messages due to the macros of the template.
It will be a great help to guide me how to change the style. Unfortunately I have only limited time to finalize the thesis.
Thank you in advance.
I reviewed the documentation of biblatex and found that the answer is very easy. One should make sure that the option style in the package biblatex is set to authoryear as style = authoryear,.
To enable the natbib Compatibility (to use \citep and \citet etc), you have to add natbib=true,.

Confusion on TikZ and PGF LaTeX packages - what they are, how they are stored by MiKTeX, and how they are interpreted by LaTeX compilers

I use VSCode to write LaTeX using the LaTeX-Workshop VSCode extension, MiKTeX, and pdflatex. The LaTeX-Workshop extension comes with the handy feature of being able to hover packages and view their documentation, but I noticed that this feature does not work on the tikz package.
Screenshot with more detail.
I started looking into why this was the case, as the ctan page linked had this long and very detailed manual for TikZ and PGF. It turns out that MiKTeX does not even list a package called TikZ, which is confusing as my .tex files seem to compile fine when including the line \usepackage{tikz}, whereas attempting to use any other 'nonexistent' package would result in a compilation error.
I've gone through half a dozen webpages trying to understand what PGF and TikZ are in more detail, but it is very confusing. The ctan PGF page says "PGF is a macro package for creating graphics... that comes with a user-friendly syntax layer called TikZ", but I'm a little confused about what that means. Why would the package and syntax have different names?
My questions can be summed up as:
What exactly is PGF and TikZ? What's the difference between the two and is there a reason why they have different names?
How does my LaTeX compiler interpret "\usepackage{tikz}" if I don't have a package by that name installed?
What are TikZ libraries and what do lines like "\usetikzlibrary{arrows}" do exactly? Are they basically the same as packages?
If I'm using MiKTeX, where are the TikZ Libraries stored on my machine (Windows 10)? I have been able to find most other packages and their documentation within subfolders of "C:\Users\{USERNAME}\AppData\Local\Programs\MiKTeX 2.9\".
Instructions on how to link the TikZ/PGF manual pdf to MiKTeX so I can easily access the documentation in VSCode would be nice, but that is not really the focus of this post.
For clarification, I am not looking for a tutorial on how to use PGF/TikZ (there are many other good resources for that), nor am I looking for an overly high-level answer like "PGF/TikZ is a LaTeX package for creating graphics" that don't provide any more detail, I know that much already.
Pre-remark:
There are two slightly different usages for the word "package" in the latex world, one is the traditional \usepackage{....} you know from your latex document, the other is the ctan/miktex/texlive package. Most of the time, a ctan/miktex/texlive package simply contains the latex package of the same name, but sometimes it can have a different name and/or contain multiple latex packages at once.
What exactly is PGF and TikZ? What's the difference between the two and is there a reason why they have different names?
pgf provides the low level commands, like strokes etc. and tikz builds on top of this and uses the low level pgf commands to draw more complicate things, like geometrical shapes or rubber ducks (shameless plug)
This division between the low level and high level code is very useful, because it allows the user to load just as much as necessary. Take for example the beamer class. It uses all kinds of low level pgf commands to draw decorations on the slides, so it loads (parts of) the pgf package. It does not need all the fancy stuff from the tikz package, so it does not load it, which safes tons of time, because loading all of tikz is relativity slow.
How does my LaTeX compiler interpret "\usepackage{tikz}" if I don't have a package by that name installed?
You do have it installed, it is contained in the ctan/miktex/texlive pgf package. \usepackage{tikz} basically translates to \input{tikz.sty}. This file in return will load the latex pgf package (and many other things)
What are TikZ libraries and what do lines like "\usetikzlibrary{arrows}" do exactly? Are they basically the same as packages?
yes, they are basically packages for tikz with which you can extend the capabilities of tikz even further.
If I'm using MiKTeX, where are the TikZ Libraries stored on my machine (Windows 10)? I have been able to find most other packages and their documentation within subfolders of "C:\Users\{USERNAME}\AppData\Local\Programs\MiKTeX 2.9\".
You can look this up yourself in your .log file. Search it for tikz.sty and this and the following lines will tell you the location of all the files.
Instructions on how to link the TikZ/PGF manual pdf to MiKTeX so I can easily access the documentation in VSCode would be nice, but that is not really the focus of this post.
If you open a new terminal in vscode (ctrl+shift+`), you can open the user guide by typing texdoc tikz or texdoc pgf (same file, just multiple ways to open it)

Writing equations in Tex

I am writing my first scientific paper, and unfortunately have a (very slow) windows PC. I had installed some packages from the Tex website some time ago, one of which is 'Tex desktop app'. It seems to be a word processor, and I have started writing things using this. However I cannot seem to insert an equation. There is certainly no icon for equations, and I have tried $...$, $\latex...$, \latex...
However my equations are not being formatted. the '\latex' is, however, color coded blue. So at least it is recognized by the program.
Does anyone know if 'Tex desktop app' is a suitable word processor to use for writing papers? If so, how do I write equations in it? Does anyone have any better suggestions for packages for writing papers that my already-pathetically-slow Windows laptop may be able to handle? I am getting very confused with all of the 'Tex' packages and what they are for...
You might want to start off by looking at the advice in the TeX FAQ. I don't use Windows, but my impression is that MikTeX is the LaTeX editor and processor for Windows. TeX is quite an old program, so you should be able to find an environment which runs acceptably even on an ancient Windows machine.
The TeX stackexchange is a good place for both beginner and advanced LaTeX questions.

What is the current state of the art in latex?

TeX and LaTeX really confuse me. I know that there is no official distribution, and that it's a bit like Linux in that there are many packagers and distributions. A lot of the distributions that people suggest to me seem to have lost their maintainers (TeTex for example). There are also different options available within those distributions for converting to pdf and so on.
What is the current consensus, the state of the art, the done thing? Is there a consensus in the first place?
Which distribution should I use (on Mac, via ports if that matters)?
What workflow (commands, tools) should I use to convert latex to pdf?
Thanks.
On Mac, the only distribution that matters is TeX Live, more specifically their Mac version called MacTex.
This distribution is very active and state of the art.
For more questions about the differences and respective advantages of TeX engines and distributions, I suggest asking a question on tex.stackexchange.com.
What workflow (commands, tools) should I use to convert latex to pdf?
In the simplest case, it’s quite enough to invoke the processor (e.g. pdflatex, or better luatex or xelatex) directly. In more sophisticated cases (e.g. you’ve got a bibliography or an index, or are using cross-references), this would require multiple passes, and running other software in between. For these cases, there exist a host of built tools for LaTeX. The simplest is probably just to use latexmk which ships with TeX Live.
I know that there is no official distribution
Most folks would agree that http://www.tug.org/texlive/ is the official distribution.
Which distribution should I use (on Mac, via ports if that matters)?
That one.
What workflow (commands, tools) should I use to convert latex to pdf?
Click on the "typeset" button. Seriously. It's just that complex.
While I agree with TeXlive (MacTeX) as the "official" distro, I disagree with "just click typeset."
LaTeX is a very powerful tool and one that needs some time to learn its intricacies, including compiling. For that task I recommend the script latexmk-pdf filename.tex as it does most of the hard work. I also always recommend the LaTeX wikibook and the AMS short math guide for learning LaTeX and for quick reference.
On Windows, I feel MiKTeX is fairly standard and also free based on my own experience and other people's review. One of the nice features of MiKTeX that I like is that you can download and install missing packages on the fly, therefore making the cost of installing new package minimum and giving you the max flexibility of choosing whatever (officially) available packages that fit your doc need.
Below is a list of relevant latex links that I collected/copied from somewhere (maybe outdated now). Hope it helps:
****** LaTex/Tex Compiler **********
MikTex: http://miktex.org/
teTex: http://www.tug.org/tetex/
***** LaTex/Tex Editor **********
Vim: http://www.vim.org/
TexNicCenter: http://www.texniccenter.org/
WinEdt: http://www.winedt.com/
LyX: http://www.lyx.org/
WinShell: http://www.winshell.de/
(X)Emax + AUCTEX: http://www.gnu.org/software/auctex/
texmaker: http://www.xm1math.net/texmaker/
TeXShop: http://www.uoregon.edu/~koch/texshop/
LEd: http://www.latexeditor.org/
***** Spelling & Grammar Checker *****
queequeg: http://queequeg.sourceforge.net/index-e.html
***** Related Image Converter/Editer **
IPE: http://tclab.kaist.ac.kr/ipe/
jpeg2ps: http://www.ctan.org/tex-archive/support/jpeg2ps/
eps2pdf: http://www.ctan.org/tex-archive/support/eps2pdf/
XFig: http://www.xfig.org/
TGIF: http://bourbon.usc.edu/tgif/download.html
**** Bibliography Management ********
JabRef: http://sourceforge.net/projects/jabref/
wbibdb22: http://www.ctan.org/tex-archive/support/bibdb/
LaTeX Bibliography Styles Database: http://jo.irisson.free.fr/bstdatabase/
**** Documentation *********
Latex Help 1.4: http://www.emerson.emory.edu/services/latex/latex2e/latex2e_toc.html
Not so short LaTeX guide: http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf
The Comprehensive LaTeX Symbol List: ftp://tug.ctan.org/pub/tex-archive/info
/symbols/comprehensive/symbols-letter.pdf
LaTeX Mathematical Symbols: http://amath.colorado.edu/documentation/LaTeX/Symbols.pdf
Short Math Guide for LaTeX: ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math
-guide.pdf
*** Integration with Other Tools *****
Tex4PPT: http://users.ecs.soton.ac.uk/srg/softwaretools/presentation/TeX4PPT/

Resources