To check whether the fonts are embedded in a PDF document, do the following.
Showing posts with label latex. Show all posts
Showing posts with label latex. Show all posts
Wednesday, November 12, 2014
Wednesday, October 1, 2014
Using LaTeX in Blogger
I found this answer on tex.stackexchange about how to include LaTeX formulas on Blogger. It worked for me! Thanks to MathJax and Matthew!
Tuesday, August 6, 2013
Rendering math in blogs
To render LaTeX-style mathematical formulae in blogs, use MathJax, as shown here. Once set up, you can do
- \( <math text> \) for inline math
- \[ <math text> \] for equations
Friday, August 2, 2013
LaTeX to HTML
To generate a HTML version of a TeX document:
- First ensure that all metadata files are up-to-date (e.g. if you have references in the tex file, run latex; bibtex; latex; latex to ensure that the .bbl file is ok).
- Run latex2html -split +1 -show_section_numbers -no_footnode myfile.tex. This will create a directory myfile containing myfile.html (among other things).
- -split +1 causes all subsections within a section to be in a single page (-split 0 will cause the whole document to be in a single page)
- -no_footnode causes footnotes to be included in the same page where they are referenced.
- See man latex2html for more options.
Thursday, July 5, 2012
LaTeX Beamer Tips
To include videos, do
\usepackage{multimedia}
\movie[externalviewer]{\includegraphics{poster.jpg}}{film.mp4}
\usepackage{multimedia}
\movie[externalviewer]{\includegraphics{poster.jpg}}{film.mp4}
Without externalviewer, the PDF viewer attempts to play the video within itself (this usually does not work).
To cover/uncover parts of slide, do
\uncover<1-4>{Show this throughout.}To cover/uncover parts of slide, do
\uncover<2-4>{Show this after the first transition.}
\only<3-4>{Show this after the second transition.}
\only<4>{Show this after the third transition.}
Roughly, \uncover puts the text on the slide before the transition but hides it. \only doesn't put the text on the slide until the specified transition. You can replace the text with image (\includegraphics), environment, etc.
To have text on the left and an explanatory image on the right, (within the frame) do
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item Blah
\item Blah Blah
\end{itemize}
\end{column}
\begin{column}{0.5\textwidth}
\centering \includegraphics{Blah.jpg}
\end{column}
\end{columns}
To display slide numbers in the footer, (in the preamble) do
\useoutertheme{infolines}
\setbeamertemplate{headline}{}
\setbeamertemplate{footline}{\insertframenumber/\inserttotalframenumber}
Move \insert... to headline to display in the header.
Friday, September 23, 2011
A `best practice' for writing papers in LaTeX
To handle complexity and versions, I do the following when I start writing a paper in LaTeX.
Some things to note:- Create new directory Conf1.
- Within this, create a new file Conf1.tex, and two new directories: tex and images.
- Conf1.tex contains: document class, title, author, bibliography style, etc., which are specific to the conference/journal. This is followed by \input{tex/main}.
- Create main.tex in directory tex. The tex directory contains all the LaTeX code, and could have further subdirectories if required (e.g., I usually have a directory for Experiments, another for Algorithm, etc.). All tex files are included in the paper by adding \input{tex/subdir/abc.tex} to main.tex in the appropriate place.
- All package inclusions (\usepackage{}), command declarations, etc. required for the paper are included in tex/include.tex.
- The first line of main.tex is \input{tex/include} followed by \begin{document} and \maketitle. Include all your LaTeX code after this. End with \bibliography{tex/biblio} followed by \end{document}, where tex/biblio.bib is the bibliography file.
- All images are stored in the directory images.
- You can use git/svn to do versioning. Until I get used to them, I am using the following method. When I have a significant frozen version, I copy the directory tex to texN where N is 1,2,3.... The timeline of versions from the earliest to the current is tex1, tex2, ..., texN, tex.
- I put the .bib file into tex because I found the bibliography changes as the paper develops.
- On the other hand, images usually accumulate. So, only the directory tex needs versioning.
- In order to use the material for another conference/journal, follow the steps above to create Conf2 and Conf2.tex. Then copy images and tex from Conf1 and compile. Your first draft of Conf2.pdf is ready!
- I read somewhere that using PDFLaTeX gives more compact files, also avoids some font problems which arise due to DVI to PDF conversion when using LaTeX. I also had problems using Beamer with LaTeX.
- If you decide to use PDFLaTeX, remember that it does NOT accept images in .eps format. I found that .png files did not render text well on conversion. Creating / converting all images in / to .pdf format (using Inkscape) worked for me.
- I use Inkscape for most drawings, and Gimp for screen capture (and also for format conversion).
Friday, September 2, 2011
Find and Replace across multiple files in Linux
For example, do this (Courtesy Rushi):
This replaces `foo' by `bar' in all .tex files in the directory mydir and its subdirectories.
This is useful for changes to latex code stored in a directory structure, since
find: gets the correct recursive file listing
-i: edit the files in place
/g: replace all occurrences in the file (globally)
foo: is a regular expression (POSIX.2 BRE)
[search tex]
find mydir -name "*.tex" | xargs sed -i 's/foo/bar/g'This replaces `foo' by `bar' in all .tex files in the directory mydir and its subdirectories.
This is useful for changes to latex code stored in a directory structure, since
find: gets the correct recursive file listing
-i: edit the files in place
/g: replace all occurrences in the file (globally)
foo: is a regular expression (POSIX.2 BRE)
[search tex]
Friday, July 8, 2011
Location of LaTeX packages
Directories where latex looks for packages:
/usr/local/share/texmf/ls-R...
/var/lib/texmf/ls-R-TEXMFMAIN...
/var/lib/texmf/ls-R-TEXLIVE...
/var/lib/texmf/ls-R...
Command to update tex about where to look for packages : texhash <new locn>
To add a .sty file where latex can find it, do
$ kpsewhich -var-value=TEXMFHOME
/home/gtholpadi/texmf
$ cp mystyle.sty /home/gtholpadi/texmf/tex/latex/local
"tex/latex/local is usually reserved for stuff installed on individual machines" (from here).
/usr/local/share/texmf/ls-R...
/var/lib/texmf/ls-R-TEXMFMAIN...
/var/lib/texmf/ls-R-TEXLIVE...
/var/lib/texmf/ls-R...
Command to update tex about where to look for packages : texhash <new locn>
To add a .sty file where latex can find it, do
$ kpsewhich -var-value=TEXMFHOME
/home/gtholpadi/texmf
$ cp mystyle.sty /home/gtholpadi/texmf/tex/latex/local
"tex/latex/local is usually reserved for stuff installed on individual machines" (from here).
Thursday, March 31, 2011
Latex Math Tips
Summations
Numbering lines of equations using align
- If summations become cramped, use \displaystyle before \sum.
- If summations should be cramped, use \textstyle before \sum.
Numbering lines of equations using align
- Use align to number all lines; use align* to switch off numbering
- In align, use \notag before \\ to switch off numbering for a line
- In align*, use \tag{...} to number (or rather tag) a line
- Given a numbered/tagged line, use \label{...} before \\ to refer to the line using \ref{...}.
- Use \allowdisplaybreaks to allow a single equation block to be split over two pages.
- \usepackage{cancel}
- Four options: \cancel{...}, \bcancel{...}, \xcancel{...}, \cancelto{<val>}{...} (in math mode)
- Use \usepackage{ulem}, \sout{...} to strike out text.
- Use \boxed{} to put a box around equations(to highlight them). Note: If you use it within the align environment, it should not contain the `&'; otherwise it will give an error.
- Use \newcommand{\myfrac}[2]{\ensuremath{\frac{#1}{#2}}} to define new commands (\myfrac) with many (2) arguments, and specify replacement latex code (\ensuremath...), including references to the arguments (#1, #2, ...). The new command can now be used in normal latex code (\myfrac{a}{b}). Aside: \ensuremath{} forces its contents to be interpreted in a math environment.
Sunday, January 30, 2011
LaTeX 'dash' usage
In LaTeX, use:
hyphen (-) : in compound words [daughter-in-law]
en-dash (--) : in number ranges [pages 31--45]
em-dash (---) : the normal dash in English punctuation
minus ($-$) : the math symbol
hyphen (-) : in compound words [daughter-in-law]
en-dash (--) : in number ranges [pages 31--45]
em-dash (---) : the normal dash in English punctuation
minus ($-$) : the math symbol
Friday, December 31, 2010
Using Unicode in Latex/Tex
To use Hindi Unicode, do the following -
In the .tex file include the line -
\font\texthi="Lohit Hindi:script=deva,mapping=tex-text" at 11pt.
(Remember to exclude the full stop at the end!)
Enter Hindi unicode text in the document as -
Some English text {\texthi हिन्दी...} more English text...
Compile the document using Xetex or XeLatex.
More information -
"texthi" is the name of the command we just defined to indicate Unicode text. You can give any other name, e.g. \font\abcd="...".
"Lohit Hindi" (remember the space between Lohit and Hindi) is the name of an Open Truetype Font (OTF) installed in the system. You can specify any other font that is installed. In Ubuntu, you can see what fonts are installed as follows -
Goto Main Taskbar -> System -> Preferences -> Appearance -> (Popup opens) -> Click 'Fonts' tab -> Try to change any of the fonts e.g. Application font. You get another popup where the fonts are listed under 'Family'. You can use any of these fonts instead of "Lohit Hindi".
"deva" is a tag that specifies which script (and hence which unicode range) should be used. Hindi uses the devanagari script. For other scripts, find out which script tag to use.
"mapping=tex-text" - I don't know what this. If you do, please tell me.
In the .tex file include the line -
\font\texthi="Lohit Hindi:script=deva,mapping=tex-text" at 11pt.
(Remember to exclude the full stop at the end!)
Enter Hindi unicode text in the document as -
Some English text {\texthi हिन्दी...} more English text...
Compile the document using Xetex or XeLatex.
More information -
"texthi" is the name of the command we just defined to indicate Unicode text. You can give any other name, e.g. \font\abcd="...".
"Lohit Hindi" (remember the space between Lohit and Hindi) is the name of an Open Truetype Font (OTF) installed in the system. You can specify any other font that is installed. In Ubuntu, you can see what fonts are installed as follows -
Goto Main Taskbar -> System -> Preferences -> Appearance -> (Popup opens) -> Click 'Fonts' tab -> Try to change any of the fonts e.g. Application font. You get another popup where the fonts are listed under 'Family'. You can use any of these fonts instead of "Lohit Hindi".
"deva" is a tag that specifies which script (and hence which unicode range) should be used. Hindi uses the devanagari script. For other scripts, find out which script tag to use.
"mapping=tex-text" - I don't know what this. If you do, please tell me.
Monday, December 20, 2010
Packages for generating figures (esp. plate diagrams)
- Inkscape
- latex
- pstricks
- tikz (http://www.mpi-inf.mpg.de/~dietz/probabilistic-models-tikz.zip, http://www.mpi-inf.mpg.de/~dietz/dirfactor-notation.pdf)
- TikZ and PGF
- xfig
- jPicEdt
- lpe (http://tclab.kaist.ac.kr/ipe/)
- omnigraffle (not free) (http://www.omnigroup.com/products/omnigraffle/)
- latex
- pstricks
- tikz (http://www.mpi-inf.mpg.de/~dietz/probabilistic-models-tikz.zip, http://www.mpi-inf.mpg.de/~dietz/dirfactor-notation.pdf)
- TikZ and PGF
- xfig
- jPicEdt
- lpe (http://tclab.kaist.ac.kr/ipe/)
- omnigraffle (not free) (http://www.omnigroup.com/products/omnigraffle/)
Wednesday, February 3, 2010
Some LaTeX tips
- Useful commands
- \footnote{} for adding footnotes in text (numbered)
- \titlenote{} for adding footnotes to titles, subtitles etc. (*, dagger etc.)
- \bibliographystyle{abbrv} to get short author names in the References
- \bibliography{<.bib file>}
- \fbox{} for enclosing text within a box
- To get a new line/line break after the paragraph title, use \paragraph{}\<space>\\
- To hyperlink text, use \href{http://my.link.org}{link text} (uses thepackage hyperref)
- \begin{figure/table}[h] - the [h] will try to force the figure/table to appear at that place in the text
- \epsfig{file=sth.eps, scale=0.25} - quick way to include .eps image.
- Ensure that label comes immediately after caption, i.e. stick to the order: \caption{}\label{}\end{figure} when including figure. [Updated]
- Add \usepackage{subfig}
- Put \subfloat[]{ \label{} \epsfig{}} \subfloat{...} ... within \begin{figure} ... \end{figure}
- Use \begin{center}\begin{tabular}... if u dont need full-fledged table
- If u have \begin{tabular}{|c|c||c|c|c|}, use \multicolumn{2}{|c||}{text} & \multicolumn{3}{|c|}to merge the first 2 and the next 3 columns.
- Use longtable instead of tabular to allow the table to be split over two pages.
\numberofauthors{4}-To spell check TeX files, use command ispell <.tex file>.
\author{
auth1 \and auth2 \and auth3 \and auth4 \and \affaddr{institutename}\\
\affaddr{address}\\
\email{\texttt{\{auth1,auth2, auth3, auth4\}@institute.edu}}
}
Subscribe to:
Posts (Atom)