Showing posts with label Latex. Show all posts
Showing posts with label Latex. Show all posts

Wednesday, July 17, 2013

LaTex: customise IEEEtran bibliography style with multibib package

When using multibib package, I wanted to apply and customise the IEEEtran bibliography style. It should be similar with bibentry.  However, it did not work. The function that repeated names of entries are replaced with dashes were disabled, but results showed that the dashes were still there. Searched the Internet but could not find a solution. OK, it’s time to debug.

Use LaTex multibib package

First, load the package using
\usepackage{multibib}

Then, in the preamble define new cite and bibliography commands through providing suffixes. For example

\newcites{jourl,conf}{{Journals},{Conferences}}

This command here gives two suffixes: jourl and conf. Therefore, we have the following new commands

\citejourl
\nocitejourl
\bibliographystylejourl
\bibliographyjourl

and

\citeconf
\nociteconf
\bibliographystyleconf
\bibliographyconf

When the commands with “jourl” are used, all the references will be put under the reference list, of which the name is “Journals” as defined in the \newcites command.

When the commands with “conf” are used, all the references will be put under then reference list, of which the name is “Conferences” as defined in the \newcites command.


When the document is compiled, there will be two auxiliary files: jourl.aux and conf.aux. These two files need to be compiled through BibTex.

Use IEEEtran bibliography style

Suppose the pub.bib file contains the entry

@ieeetranbstctl{BSTcontrol,
        CTLdash_repeated_names = {no},
        CTLuse_alt_spacing = {no}}

To apply this control entry to the “Journals” reference list, we should call

\bstctlcite[@auxoutjourl]{BSTcontrol_Thesis}
\bibliographystylejourl{ieeetran}
\bibliographyjourl{pub}   

Note that there is an optional argument in the \bstctlcite command which includes the suffix “jourl”. To control the "Conferences" list, simply change the optional argument accordingly.

Monday, April 08, 2013

Modify font size when using FncyChap package

The latex package FncyChap provides several nice pre-defined style for chapter headings. However, I found out the chapter title takes too much space sometimes; it may take more than two thirds of the page. Thus, it is necessary to reduce the font size for the chapter title.
The first step is to find out what is the default value in the pre-defined layout, which can be found in the FncyChap document. Take the ‘Lenny ’ style as an example. The default settings for the chapter title is
\ChTitleVar{\Huge\bfseries\rm}

To change the title size from ‘\Huge’ to other values, in the preamble, add the following
\makeatletter

\ChTitleVar{\huge\bfseries\rm}

\makeatother

Now the font size is smaller and suitable for long chapter titles.

Thursday, May 03, 2012

Latex bibentry package and IEEE bibliography style

When I used Latex bibentry package together with IEEEtran bibliography style, an error would occur:
paragraph ended before \BR@bibitem was complete.

Googled but didn't find any solution until came to this page. The solution is to use the IEEEtrantools LaTeX package

To use the package, load it using
\usepackage[retainorgcmds]{IEEEtrantools}

The option [retainorgcmds] asks IEEEtrantools NOT to override the standard LaTeX itemize, enumerate and description list environments.

Of course you need to load bibentry

\usepackage{bibentry}  


Add the following entry to the .bib file:

@ieeetranbstctl{BSTcontrol,
        CTLdash_repeated_names = {no},
        CTLuse_alt_spacing = {no}}

This entry is to give you the access to the IEEEtran.bst controls. CTLdash_repeated_names controls whether dashes are used for repeated names or not. CTLuse_alt_spacing controls the alternate interword spacing for bib entries with URLs. The label of the entry "BSTcontrol" can be changed as long as you use the same name in the \bstctlcite{} command.

After the \begin{document} command, add

\bstctlcite{BSTcontrol} % activate the IEEEtran controls.
\nobibliography*
\bibliographystyle{ieeetran}
Now the bibentry works well with IEEEtran style.

References:
http://www.mail-archive.com/lyx-users@lists.lyx.org/msg70594.html
http://www.michaelshell.org/tex/ieeetran/tools/
http://mirrors.ctan.org/macros/latex/contrib/IEEEtran/bibtex/IEEEtran_bst_HOWTO.pdf

Friday, September 16, 2011

YAP cannot find the path specified when using TexStudio

This week I started to use TexStudio, formerly knowns as TexMakerX, on my laptop. When I press 'F3' to view the dvi file, the following error occurs:
Windows API error 3: The system cannot find the path specified.
It also gives you the file path it cannot find in the same window.

The strange thing is, the file is in the given path. However, the YAP cannot find it. My system is 64-bit Windows 7, maybe it has something to do with they system? Googled a bit, nothing useful. Then I switched to TeXnicCenter, guess what, it is working perfectly. Thus there should be something wrong with the TexStudio configuration.

Looked at the TexStudio log windows, it shows
Process started: "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\yap.exe" -1 -s 14F:\folder x\math.tex "F:\folder x\math.dvi"
And in the configuration, it is the default value except the yap path.
"C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\yap.exe" -1 -s @?c:ame "?am.dvi"

After checked it carefully, I realised that the space in the path may cause the problem: the math.tex file in the log window doesn't have a "" to enclose the path. So here comes the solution. Change the dvi viewer command into one of the following in the configuration:

  1. "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\yap.exe" -1 -s @?c:ame" "?am.dvi"
  2. "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\yap.exe" -1 -s @%.tex %.dvi

Replace the yap path based on your system. Either of the approaches above has been tested and works well.





Monday, September 12, 2011

Latex equation editor for Word and PowerPoint

If you use Latex, usually you hate the equation editor that is built in Microsoft office. One of the miserable factors is that, though the Microsoft office suit has been in the market for more than 20 years, Microsoft failed to provide a decent mathematical equation editor for the academics. In this post, I would like to share the tools I use for Word and PowerPoint.


Both TexSword and IguanaTex have been tested with Office 2010 and they work well.

Monday, June 06, 2011

Quick setup guide for Latex in Windows

Latex is complex enough for some users. So, here comes the quick setup guide if you use Windows operating systems.
  1. Download the necessary software.
  2. Install the software.
    • Install the Ghostscript. The default setting should be fine.
    • Double click the proTeXt to unzip it to a temporary folder. Navigate into the folder and install MiKTex, full installation is recommended.
    • Install TeXnicCenter or TeXstudio, or both.
  3. Done! ;)

    Thursday, December 09, 2010

    et al ie and eg in Latex

    When writing a paper, it is common to use et al., i.e., e.g.. However, in Latex, you cannot simply use the forms "i.e." or "e.g." These words end with a period and Latex will treat the period as the end of a sentence. Thus extra space is added automatically. To prevent the extra space in Latex, the correct use of these words is
    • i.e.\
    • e.g.\
    • et al.\
    For example, "...two colours, i.e.\ red and blue."

    Monday, April 19, 2010

    Package caption Warning: Unsupported document class (or package) detected

    Often, when you use IEEE templates, the following warnings may appear:

    Package caption Warning: Unsupported document class (or package) detected, (caption) usage of the caption package is not recommended.

    This happens because the IEEEtrans Class has its own definition on caption layout, and one of the packages you used calls package caption.

    To get rid of this warning, disable the caption function of that package. For example, subfig package provides the following solution:
     
    \usepackage[caption=false, ...]{subfig}

    Friday, December 11, 2009

    Enable forward/Inverse search with DVI in TexMakerX

    TexMakerX is a fork of TexMaker with many enhanced features. However, following the user manual, you cannot enable the forward/Inverse search function. Ok, let's make it short, here is the workaround.

    First, follow the instruction given at http://www.xm1math.net/texmaker/doc.html#SECTION37 or TexMakerX user manual.

    Then change the latex command line to
    latex --src -interaction=nonstopmode %.tex

    Now, enjoy.

    Friday, May 08, 2009

    Place the bibliography entry in the text

    Sometimes we need to put the bibliography entry in the text, how can we do it in Latex?

    The answer is to use package bibentry, which is included in natbib package.

    After \beging{document}, put \nobibliography* (used with \bibliography{database}) or \nobibliography{database}. In the place where you want to show the bibliography entry, put \bibentry{label}.

    In addition, \bibliographystyle{style} can be placed anywhere in the document.

    Here are two examples.
    1
    \begin{document}
    \nobibliography*
    ...
    \bibliography{database}
    \bibliographystyle{style}
    \end{document}


    2
    \begin{document}
    \nobibliography{database}
    ...
    \bibliographystyle{style}
    \end{document}

    Tuesday, September 16, 2008

    Double-column figure in two column papers of Latex

    How to create a figure crossing columns in a two column paper using Latex? The solution is quite simple.

    Use \begin{figure*} ... \end{figure*}. For tables, use \begin{table*} ... \end{table*}.

    Tuesday, August 05, 2008

    TeXnicCenter is back!

    In my opinion, TeXnicCenter is the best Latex editor among a number of freewares and sharewares. However, lacking of developers, TeXnicCenter seemed to fade away after releasing the Beta 7.01 in June 2006. Last week, when I visited their website, found that a new maintainer for the software development joined. Moreover, a new version Beta 7.50 was released in June 2008.

    Although TeXnicCenter versions always come with "Beta", it has been proven to be stable. The developer will release a stable version at the end of 2008, with Unicode support.

    LED is another great software with so-called Unicode support. The newest version was released in May, 2008. An annoying bug with LED is that, you cannot type in Chinese. If you do so, the editor cannot display the characters correctly. This issue has been reported with the coming of 5.x version of LED last year. But it seems that it is not a problem to the software author at all.

    Thursday, July 03, 2008

    Stack math symbols in Latex

    When typing in formulas in Latex, sometimes we need to stack math symbols, especially with arrows. Here are some examples that show how to achieve this goal.
    1. Using \xleftarrow or \xrightarrow. Both of them have the same syntax.
      a=b \xleftarrow[H]{\xi+a\timesc} f=g

      a=b \xleftarrow[H]{\xi+a\timesc} f=g
    2. Using \overset
      a=b\overset{F}{\longleftarrow}c=d

      a=b\overset{F}{\longleftarrow}c=d
    3. Using \underset
      a=b\underset{F}{\longleftarrow}c=d


    4. Using \stackrel
      a=b \stackrel{F}{\longleftrightarrow}c=d

      a=b \stackrel{F}{\longleftrightarrow}c=d
    5. Using \mathop
      ab \mathop{\sum\sum\sum}_{a=\frac{1}{2}\times 100000}^{b=\frac{4}{5}}cd

      ab \mathop{\sum\sum\sum}_{a=\frac{1}{2}\times 100000}^{b=\frac{4}{5}}cd
    Chinese version:Latex: 堆叠数学符号

    Friday, December 07, 2007

    Rename bibliography title in Latex

    Sometimes we need to rename the bibliography's title in Latex, for example, we want the title to be 'References'.

    In the preamble, add "\renewcommand\refname{New Title}" for article type documents and "\renewcommand\bibname{New Title}" for book and report type documents.

    Wednesday, November 28, 2007

    Marking version in Latex


    Package prelim2e allows you to mark versions in Latex. The information will appear on the bottom of every page. It is quite simple to use it.
    Add \usepackage{prelim2e} before \begin{document}. And then renew the version text as follows.
    • \renewcommand{\PrelimText}{Draft}, where Draft is the text you want to insert. \PrelimText represents the whole thing as shown in the figure.
    • Another way is \renewcommand{\PrelimWords}{Preliminary version: \textbf{\emph{draft}}} , if you want to keep the time information. Preliminary version: \textbf{\emph{draft}} is the text you want to change.
    The figure above uses the following command:
    \renewcommand{\PrelimWords}{\textbf{\emph{draft}}: ver. $\alpha \ 1.15$}

    Please refer to the package document for greater detail.

    Friday, October 05, 2007

    Creat an empty page in Latex

    It is necessary to use a trick when creating an empty page in Latex. The following code does the job:

    \newpage

    \thispagestyle{empty}
    \mbox{}

    The major part is \mbox{}, which ensures the existence of an empty page.

    The usage of \thispagestyle is
    \thispagestyle{option}. The option can be:

    • plain - Just a plain page number.
    • empty - Produces empty heads and feet - no page numbers.
    • headings - Puts running headings on each page. The document style specifies what goes in the headings.
    • myheadings - You specify what is to go in the heading with the \markboth or the \markright commands.


    The usage of \thispagestyle comes from Hypertext Help with LaTeX.

    Friday, September 07, 2007

    Roman numerals in Latex

    Ok, we have to admit that it is not easy to input roman numerals in Latex. There is still a way.

    In the preamble, i.e. before \begin{document}, define

    \makeatletter
    \newcommand{\rmnum}[1]{\romannumeral #1}
    \newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
    \makeatother

    Then in the document part, \rmnum{num} is used to input the roman numeral of num, \Rmnum is for the uppercase. If you prefer to use other commands, just change the red part in the definition part.

    If only lowercase roman numerals are occasionally used, \romannumeralnum can do it. In this approach, definition is not necessary.

    Someone anonymous commented that "Nice, but it fails for N=4000 and above." However, in my system, it is working for 4000 and above.

    Update: again, someone anonymous pointed out that MMMM is not allowed. Based on the information I found on the Internet, it is OK. But once the number goes bigger again, the convert is not correct.

    Sunday, July 29, 2007

    Sort and compress numerical citations

    As mentioned in Latex hyperref and cite packages, packages cite and natbib are used to sort numerical citations. The usage of cite is

    \usepackage{cite}

    It is quite simple because you don't need to do anything more. [21,18,22,23] will be automatically sorted and compressed as [18, 21-23].

    To get the same results, options needed to be provided using natbib:

    \usepackage[options]{natbib}

    Options can be sort&compress or compress. The former one sorts and compresses the citations and the latter one compresses the citations only. Because of the compatible issue, natbib is recommended.

    Monday, July 16, 2007

    Latex hyperref and cite packages

    There is a conflict between cite package and hyperref package. Hyperref cannot generate hyper links from the citations generated by cite. Cite package is used to sort and compress numerical citations. Another package natbib can be used alternatively to solve this compatibility issue.

    However, when one of the options sort&compress or compress in the \usepackage[]{natbib} command is used, the options backref and pagebackref of hyperref encounter a problem. The compressed references don’t have back hyper links. For example, with [39-43], the reference 40 doesn’t have back reference hyper links. To solve this issue, simply discard compress option and reuse it in the final copy.

    One more, cite and natbib cannot stay together ;P.

    Chinese version:

    Latex 宏包: hyperref 和 cite

    http://time360.blogspot.com/2007/09/latex-hyperref-cite.html

    Wednesday, July 04, 2007

    gswin32c.exe crashes with EPS figures


    What is the difference between these two figures? One is green and the other is stripy. After inserting it to a Latex document and running DVI-->PS, you will know another distinction. The striped figure makes gswin32c.exe crash while the first doesn't.

    Yesterday, I met this problem. Soon after the problem occurred, I was aware of that my figures caused the problem. Then I tried to use different ways to get the EPS figures. However, they all didn't work. I had no idea what happened. Finally, I tried to fill the image using a pure colour. Luckily enough, it worked.