Monday, December 10, 2007

beamer 3.01 and rowcolors (after year 2007)

% see http://osdir.com/ml/tex.latex.beamer.general/2005-06/msg00011.html
\documentclass[12pt, slidestop, mathserif, compress, xcolor=table, dvips]{beamer} %% show comment, works!!
% xcolor=table needed to be added, otherwise, rowcolors=... will have error.

beamer

In Sept.2, 2008, install Latex in Ubuntu, need to use
sudo apt-get install texlive tetex-base tetex-bin tetex-extra

To handle error
Option clash for package pstricks

remove line
\usepackage{pstcol}
which will clash with \usepackage{pstricks}

To handle error
Undefined control sequence \pst@usecolor

Change from

\documentclass[12pt, slidestop, Palatino, mathserif, compress, xcolor=pst, dvips]{beamer}

to
\documentclass[12pt, slidestop, Palatino, mathserif, compress, dvips]{beamer}

That is, get rid of the option xcolor=pst (predicted by Dr. Oporowski when I used xcolor=pst as a pad to fix the problem)


Saturday, November 3, 2007

Limit web access time

packages available in ubuntu are

squid timeout

dansguardian firehol tinyproxy

A good website concerning squid is

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch32_:_Controlling_Web_Access_with_Squid

Tuesday, October 9, 2007

system complaining do not recognize green!25!gray

re-download xcolor package and add the following line to your latex file

\usepackage{xcolor}

Thursday, August 30, 2007

Latex Tips from Zhou Chen

top - feedbackLinux --> Latex --> Tips for Latex

Some tips:

Source: http://www.ntu.edu.sg/home5/pg04878518/LatexTips.html#q5

1. Want to include Java/C++/Pascal source code. How can I get syntax highlighting?

2. DVIPS can't find tx8r.enc

3. How to auto-complete cites or refs?

4. How to edit and compile multiple latex files with one master file?

5. How to change the text's default size in a region?

6. Some Features about Tables, Floats and Numbering

7. How to easily input the table?

8. How to show the figures if they are blocked at the end of the chapter?

1. Want to include Java/C++/Pascal source code. How can I get syntax highlighting?

There is a greate package which supports syntax highlighting for a huge amount of programming languages (Fortran, C, C++, csh, HTML, Java, Matlab, Mathematica, Pascal, Perl, SQL, XML, Delphi, PHP, VBScript, SAS and even Latex itself - and many more). The usage is simple:

  • Load the package: \usepackage{listings}
  • Set the language: \lstset{language=TeX}
  • Open a lstlisting environment: \begin{lstlisting}
  • Include all your programming code
  • Close the lstlisting environment: \end{lstlisting}

If this does not seem to work for your language, even if the language is listed above, try upgrading to the lastest MiKTeX version. The listings package is being updated continuously.

Here's a more advanced example on the source code highlight:

 \usepackage{color}
\usepackage{listings}
\definecolor{Brown}{cmyk}{0,0.81,1,0.60}
\definecolor{OliveGreen}{cmyk}{0.64,0,0.95,0.40}
\definecolor{CadetBlue}{cmyk}{0.62,0.57,0.23,0}
\begin{document}

\lstset{language=R,frame=ltrb,framesep=5pt,basicstyle=\normalsize,
keywordstyle=\ttfamily\color{OliveGreen},
identifierstyle=\ttfamily\color{CadetBlue}\bfseries,
commentstyle=\color{Brown},
stringstyle=\ttfamily,
showstringspaces=ture}

\begin{lstlisting}
...
\end{lstlisting}

2. DVIPS can't find tx8r.enc

This problem can occur in MiKTeX. It is caused by an error in the psfonts.map file, that is located in \MiKTeX\texmf\dvips\config. The solution is quite simple:

  • Open Windows Explorer and go to the directory \MiKTeX\texmf\dvips\config
  • Rename the file psfonts.map to psfonts.map.org
  • Rename the file psfontes.map.miktex-2.0 to psfonts.map

This will solve your problem. Hopefully this problem will be solved in future releases of MiKTeX

3. How to facilitate to use of cites or refs in Emacs AuCTeX mode? Lets you click on a \cite{reference} Latex command to display the citation from the apprpriate bibtex source file, or moves to its location in the bibtex source file to edit it. It also moves between or displays matching \label and \ref commands.

One tool with the new AUCTeX which could be handy is bib-cite.el, so load that from your .emacs file if you want to use it. It highlites \cite, \ref, \label commands and if you click the left mouse on a citation, pops up a buffer showing the bibtex entry. Other commands are.

;;   
;; bib-display bib-display-mouse (mouse-1)
;; - Display citation, \ref or \label under point
;; bib-find bib-find-mouse (mouse-2)
;; - Edit citation, \ref or \label under point
;; bib-make-bibliography - Make BiBTeX file containing only cite keys used.
;; bib-apropos - Search BiBTeX source files for keywords.
;; bib-etags - Refreshes (or builds) the TAGS files for
;; multi-file documents.
;; bib-create-auto-file - Used in bibtex-mode to create cite key
;; completion .el file for auctex.
;; bib-highlight-mouse - Highlight \cite, \ref and \label commands in
;; green when the mouse is over them.
The only problem yet to be sorted out is how bib-cite finds your bibtex files. At the moment, it is only reliable for bibtex files in the same directory as the tex file, or anywhere specified by the env var BIBINPUTS, but this can be changed via
(defvar bib-bibtex-env-variable "BIBINPUTS")
In AuCTeX mode, you can want to enter \\ref or \\cite, press following keys:
ContentShort Key
\refC-c )
\citeC-c [
A popup will remind you to input the regular expression and then filter the proper ones. These Ref tools will help your work greatly!

4. How to edit and compile multiple latex files with one master file in Emacs' AuCTeX mode? When you, for example, ask AUC TeX to run a command on the master file, it has no way of knowing the name of the master file. By default, it will assume that the current file is the master file. If you insert the following in your `.emacs' file AUC TeX will use a more advanced algorithm.

     (setq-default TeX-master nil) ; Query for master file.
If AUC TeX finds the line indicating the end of the header in a master file (`TeX-header-end'), it can figure out for itself that this is a master file. Otherwise, it will ask for the name of the master file associated with the buffer. To avoid asking you again, AUC TeX will automatically insert the name of the master file as a file variable (Note: File Variables.). You can also insert the file variable yourself, by putting the following text at the end of your files.
     % Local Variables:
% TeX-master: "master"
% End:
You should always set this variable to the name of the top level document. If you always use the same name for your top level documents, you can set `TeX-master' in your `.emacs' file.
     (setq-default TeX-master "master") ; All master files called "master".

5. How to change the text's default size in a region?

Try to use the following keywords to temporarily change the text's default size:

\tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, \LARGE, \huge, \Huge.


6. Some Features about Tables, Floats and Numbering

Multipage tables can be produced using the longtable package. If you need color, look at the colortbl package.

How to put more tables and graphics on a page? By default, LaTeX only allows up to 3 floats taking up to 0.7 of the page to be on a text page. There are no such limits on figures placed on a `float page' (a page with floats but no regular text), but LaTeX will not create a float page unless it can cover half of it with floats. This behaviour can be changed by placing lines like the following before \begin{document}

\renewcommand\floatpagefraction{.9}
\renewcommand\topfraction{.9}
\renewcommand\bottomfraction{.9}
\renewcommand\textfraction{.1}
\setcounter{totalnumber}{50}
\setcounter{topnumber}{50}
\setcounter{bottomnumber}{50}
The following variables control the vertical spacing with figures
\floatsep     separation between floats on a page with text
\intextsep separation between floats and the text
plus the hidden parameters for float pages:
\@fptop       space at top of float page
\@fpbot space at bottom of float page
\@fpsep space between floats on a float page
The vertical space between a graphic and the caption below it is \abovecaptionskip (10pt default) and the vertical space below a caption is \belowcaptionskip (0pt).

Numbering: With bigger documents you may want to have per-section figure and equation numbering. The class sometimes provides what you want. Alternatively, you can use

\usepackage{chngcntr}

\counterwithin{figure}{section}
\counterwithin{equation}{section}
\begin{document}
...

7. How to easily input the table?

Table input, especially the large and complex ones, is a hard work in pure text mode for latex users. You can use some assistant tools to help you to input the tables, such as latable, tablas, etc.


8. How to show the figures if they are blocked at the end of the chapter?

If figures are not shown at the chapter's proper place but at the ending of the chapter, this is cause by a big figure that blocks following small pictures from displaying. One way to solve this problem is to put the following line in your latex source file to enforce the figure's displaying.

\clearpage

References:

[1] Here's a good Latex FAQ site: http://www.tex.ac.uk/cgi-bin/texfaq2html

[2] Some tips here: http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/reports.html

Display C++ Codes with syntax highlight

source: http://www.ntu.edu.sg/home5/pg04878518/LatexTips.html#q1
googled by "latex C++ syntax highlight listings"

1. Want to include Java/C++/Pascal source code. How can I get syntax highlighting?

There is a greate package which supports syntax highlighting for a huge amount of programming languages (Fortran, C, C++, csh, HTML, Java, Matlab, Mathematica, Pascal, Perl, SQL, XML, Delphi, PHP, VBScript, SAS and even Latex itself - and many more). The usage is simple:

  • Load the package: \usepackage{listings}
  • Set the language: \lstset{language=TeX}
  • Open a lstlisting environment: \begin{lstlisting}
  • Include all your programming code
  • Close the lstlisting environment: \end{lstlisting}

If this does not seem to work for your language, even if the language is listed above, try upgrading to the lastest MiKTeX version. The listings package is being updated continuously.

Here's a more advanced example on the source code highlight:

 \usepackage{color}
\usepackage{listings}
\definecolor{Brown}{cmyk}{0,0.81,1,0.60}
\definecolor{OliveGreen}{cmyk}{0.64,0,0.95,0.40}
\definecolor{CadetBlue}{cmyk}{0.62,0.57,0.23,0}
\begin{document}

\lstset{language=R,frame=ltrb,framesep=5pt,basicstyle=\normalsize,
keywordstyle=\ttfamily\color{OliveGreen},
identifierstyle=\ttfamily\color{CadetBlue}\bfseries,
commentstyle=\color{Brown},
stringstyle=\ttfamily,
showstringspaces=ture}

\begin{lstlisting}
...
\end{lstlisting}

2. DVIPS can't find