Use the verbatim environment with small text (\small\begin{verbatim}) causes error in
the mdframe environment. To solve this, use the fancyvrb package with
\begin{Verbatim}[fontsize=\small]
\end{Verbatim}
Verbatim environment and mdframe package
When using an mdframed package to create a box around the verbatim environment,
\surroundwithmdframed[style=bluebox]{Verbatim}
the text following the environment becomes white. To fix this, use the fancyvrb package
and set the box to the Verbatim environment instead:
\usepackage{fancyvrb}
\surroundwithmdframed[style=bluebox]{Verbatim}
Latex tips
Monday, October 6, 2014
Thursday, July 24, 2014
Fixing Latex Errors
- Using \begin{table*} in a single-column document will cause "Incomplete \iffalse:" error.
- Use {\small \begin{verbatim} \end{verbatim}} will cause "Missing } inserted." error.
Fixed by using package fancyvrb :
\begin{Verbatim}[fontsize=\small]
\end{Verbatim}
Fix \labelindent already defined error when using enumitem package and IEEEtran class
Insert
\let\labelindent\relax
before calling \usepackage{enumitem}
Tuesday, July 1, 2014
Setting up local texmf tree
1. Use the command
sudo tlmgr conf texmf TEXMFHOME "~/Library/texmf:~/remote/shared/texmf"
The default place for this file is
/usr/local/texlive/<year>/texmf.cnf
2. Try running kpsewhich -var-value TEXMFHOME to see where
TeX thinks your local texmf tree should be.
sudo tlmgr conf texmf TEXMFHOME "~/Library/texmf:~/remote/shared/texmf"
The default place for this file is
/usr/local/texlive/<year>/texmf.cnf
2. Try running kpsewhich -var-value TEXMFHOME to see where
TeX thinks your local texmf tree should be.
Create Beamer slides with presenter notes.
1. Add the following lines in Latex header:
\usepackage{pgfpages}
\setbeamertemplate{note page}[compress] %% plain or default
\setbeameroption{show notes on second screen=left} % right = Content, left = notes
The option "left" will create a note page while the option "right"
will create a presentation slides.
2. In the beamer source, use \note{ xxxx your content} in each frame.
Only itemize environment can be used.
3. Create two pdf files, one is the presentation slides and another is
the presenter note file.
4. Open both files using Skim. In the presentation file, go to View ->
Presentation Options --> Synchronized Notes Document, and select the
presenter note pdf file.
5. Drag the presentation window to the projector screen and keep the
presenter note window in the laptop screen.
6. Start the presentation. The presenter note page will follow the
presentation page.
\usepackage{pgfpages}
\setbeamertemplate{note page}[compress] %% plain or default
\setbeameroption{show notes on second screen=left} % right = Content, left = notes
The option "left" will create a note page while the option "right"
will create a presentation slides.
2. In the beamer source, use \note{ xxxx your content} in each frame.
Only itemize environment can be used.
3. Create two pdf files, one is the presentation slides and another is
the presenter note file.
4. Open both files using Skim. In the presentation file, go to View ->
Presentation Options --> Synchronized Notes Document, and select the
presenter note pdf file.
5. Drag the presentation window to the projector screen and keep the
presenter note window in the laptop screen.
6. Start the presentation. The presenter note page will follow the
presentation page.
Typesetting Thai
Make Texshop aware of Thai encoding
add the following two lines
before \begin{document}
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
From: http://poonlap.blogspot.com/2012/03/tex-mac-os-x.html
Thai hyphenation
\usepackage{polyglossia}
\XeTeXlinebreaklocale "th_TH"
\XeTeXlinebreakskip = 0pt plus 1pt
Use different fonts for different languages
http://tex.stackexchange.com/questions/183424/xelatex-how-to-specify-a-different-font-family-for-latin-text-within-non-latin

add the following two lines
before \begin{document}
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
From: http://poonlap.blogspot.com/2012/03/tex-mac-os-x.html
Thai hyphenation
\usepackage{polyglossia}
\XeTeXlinebreaklocale "th_TH"
\XeTeXlinebreakskip = 0pt plus 1pt
Use different fonts for different languages
http://tex.stackexchange.com/questions/183424/xelatex-how-to-specify-a-different-font-family-for-latin-text-within-non-latin
The package
ucharclasses
does this. For short insertions of text in other alphabets hyphenation shouldn't be a concern; for longer parts, using the various features of polyglossia
is recommended.\documentclass{article}
\usepackage{polyglossia}
\usepackage{fontspec}
\setmainlanguage{thai}
\newfontfamily\thaifont{Thonburi}
\newfontfamily\englishfont{TeX Gyre Bonum} % just to get a distinctive font
\usepackage[Latin,Thai]{ucharclasses}
\setTransitionsForLatin
{\begingroup\englishfont}
{\endgroup}
\begin{document}
ดาวพุธมีหลุมอุกกาบาตจำนวนมากจนดูคล้ายดวงจันทร์ ภูมิลักษณ์ที่เด่นที่สุดบนดาวพุธ คือ
แอ่งแคลอริส (Caloris Basin) ดาวพุธมีหลุมอุกกาบาตจำนวนมากจนดูคล้ายดวงจันทร์
ภูมิลักษณ์ที่เด่นที่สุดบนดาวพุธ คือ แอ่งแคลอริส
\end{document}

List
Nesting enumerate
# Make it 1, 1.1, 1.2, 2, 2.1, 2.2
\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}}
# Make it A, a/b/c, B, a/b/c
\renewcommand{\labelenumi}{\Alph{enumi}}
\renewcommand{\labelenumii}{\alph{enumii}}
Change the symbols in the list environment
Define the new environment as
\newcounter{bean}
\newenvironment{iletter}{\begin{list}{(\alph{bean})}{\usecounter{bean}\setlength{\parsep}{-1pt}}}{\end{list}}
\newenvironment{iLetter}{\begin{list}{\Alph{bean}.}{\usecounter{bean}\setlength{\parsep}{-1pt}}}{\end{list}}
\newenvironment{question}{\begin{enumerate}{}{\setlength{\leftmargin}{0pt}%
\setlength{\rightmargin}{\leftmargin}%
\setlength{\parsep}{-10pt}}}{\end{enumerate}}
# Make it 1, 1.1, 1.2, 2, 2.1, 2.2
\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}}
# Make it A, a/b/c, B, a/b/c
\renewcommand{\labelenumi}{\Alph{enumi}}
\renewcommand{\labelenumii}{\alph{enumii}}
Change the symbols in the list environment
Define the new environment as
\newcounter{bean}
\newenvironment{iletter}{\begin{list}{(\alph{bean})}{\usecounter{bean}\setlength{\parsep}{-1pt}}}{\end{list}}
\newenvironment{iLetter}{\begin{list}{\Alph{bean}.}{\usecounter{bean}\setlength{\parsep}{-1pt}}}{\end{list}}
\newenvironment{question}{\begin{enumerate}{}{\setlength{\leftmargin}{0pt}%
\setlength{\rightmargin}{\leftmargin}%
\setlength{\parsep}{-10pt}}}{\end{enumerate}}
Reduce spacing between successive items
\addtolength{\itemsep}{-0.1in}
Some useful variables are
Page Layout
\columnsep: gap between columns
\topmargin: gap above header
\topskip: between header and text
\textheight: height of main text
\textwidth: width of text
\oddsidemargin: odd page left margin
\evensidemargin : even page left margin
Paragraphs
\parindent: indentation of paragraphs
\parskip: gap between paragraphs
Floats (tables and figures)
\floatsep: space left between floats.
\textfloatsep: space between last top float or first bottom float and the text.
Some useful variables are
Page Layout
\columnsep: gap between columns
\topmargin: gap above header
\topskip: between header and text
\textheight: height of main text
\textwidth: width of text
\oddsidemargin: odd page left margin
\evensidemargin : even page left margin
Paragraphs
\parindent: indentation of paragraphs
\parskip: gap between paragraphs
Floats (tables and figures)
\floatsep: space left between floats.
\textfloatsep: space between last top float or first bottom float and the text.
\intextsep : space left on top and bottom of an in-text float.
\dbltextfloatsep is \textfloatsep for 2 column output.
\dblfloatsep is \floatsep for 2 column output.
\abovecaptionskip: space above caption
\belowcaptionskip: space below caption
Maths
\abovedisplayskip: space before maths
\belowdisplayskip: space after maths
\arraycolsep: gap between columns of an array
Lists
\topsep: space between first item and preceding paragraph.
\partopsep: extra space added to \topsep when environment starts
a new paragraph.
\itemsep: space between successive items.
\vspace{-0.2in}
\begin{figure}[h]
List environment without spacing before/after paragraphs and between two list item,
\usepackage{enumitem}
\setlist{nolistsep}
To set space before equations, put these lines after \begin{document}
\setlength{\abovedisplayskip}{10.0pt plus 2.0pt minus 5.0pt}
\setlength{\belowdisplayskip}{10.0pt plus 2.0pt minus 5.0pt}
\setlength{\abovedisplayshortskip}{0.0pt plus 3.0pt}
\setlength{\belowdisplayshortskip}{6.0pt plus 3.0pt minus 3.0pt}
\setlength{\abovecaptionskip}{10.0pt plus 2.0pt minus 5.0pt}
\setlength{\belowcaptionskip}{10.0pt plus 2.0pt minus 5.0pt}
Reduce column spacing in tabular environments
\begin{table}[!h]\centering
\caption{}\label{}\small
\small\addtolength{\tabcolsep}{-2pt}
\begin{tabular}
List environment without spacing before/after paragraphs and between two list item,
\usepackage{enumitem}
\setlist{nolistsep}
To set space before equations, put these lines after \begin{document}
\setlength{\abovedisplayskip}{10.0pt plus 2.0pt minus 5.0pt}
\setlength{\belowdisplayskip}{10.0pt plus 2.0pt minus 5.0pt}
\setlength{\abovedisplayshortskip}{0.0pt plus 3.0pt}
\setlength{\belowdisplayshortskip}{6.0pt plus 3.0pt minus 3.0pt}
\setlength{\abovecaptionskip}{10.0pt plus 2.0pt minus 5.0pt}
\setlength{\belowcaptionskip}{10.0pt plus 2.0pt minus 5.0pt}
Reduce column spacing in tabular environments
\begin{table}[!h]\centering
\caption{}\label{}\small
\small\addtolength{\tabcolsep}{-2pt}
\begin{tabular}
Subscribe to:
Posts (Atom)