Icecafe’s Weblog

Whatever we want…

Archive for February, 2008

Insert figures into LaTeX articles

Posted by icecafe on February 15, 2008

Inserting single figures into LaTeX articles

First off, you have to have some text in your file before you can include any diagrams without LaTeX complaining.Then you can insert a picture with something like:

\begin{figure}[htp]
\centering
\includegraphics{erptsqfit}
\caption{Transverse momentum distributions}\label{fig:erptsqfit}
\end{figure}
  • Fig.[fig:erptsqfit] is your basic picture. The [htp] command works like usual to tell LaTeX how to position the graphic in the text.
  • The placement specifier p lets the figure take up a full page without waiting until the end of the chapter
  • centering tells LaTeX to centre everything within the graphics environment.
  • includegraphics is your basic command to include a graphics object. (The bits in [...] shown below are various options that can be omitted. In the curly brackets is the name of the file you want included.) As you can see the extension of the graphics filename is omitted – LaTeX looks for this file with various possible extensions – .eps, .ps, … (Note: LaTeX will look for filename.ps before filename.eps.)
  • the most important option in [...] is the size. There are a few choices that are useful …
      [width=xxx cm], … [height=xxx cm], etc.

A slightly more complicated version looks like the below example. This is used to select only a portion of your picture, and the part of the caption in square brackets is taken as the caption in a list of figures. This means that you can format the caption that appears with your figure differently to the way it will appear in the list of figures. Also, the figure caption will typically be longer, and more detailed than that which appears in the list of figures.

\begin{figure}[htp]
\centering
\includegraphics[totalheight=0.8\textheight,viewport=50 260 400 1000,clip]{erptsqfit}
\caption[Transverse momentum distributions - E-R model.]
{Transverse momentum distributions - E-R model fit (intercept 1.2).}\label{fig:erptsqfit}
\end{figure}

The most useful option to use, I find, is to set the width or height you want your picture scaled to to be some fraction of the textwidth or height, as is done in the above, where we have [totalheight=0.8\textheight], that is, the total height of the figure is set to 80\,\% of the height of the text on a normal page of typing.

The viewport command needs some fiddling with to get right – if you choose to use it at all (you need it for mathematica files as they are saved very very poorly as PS files). Basically it’s the number of points to take off the top, left, bottom, right, in that order, I think. You just have to play around and see. The idea is, it takes this much space off all around the document, leaving only the inside bit that is what you want to see in your document. You need the “clip” command to force LaTeX to ignore the stuff outside the limits you specify by “viewport”.

  • The stuff in [...] in the caption command tells LaTeX what to put in the table of contents. Otherwise is just uses the stuff in the curly brackets if you omit [...]. The stuff in curly brackets is what appears as your figure caption.

Multiple figures

Multiple figures can be inserted in this manner (where here I have just used the same figure several times). The \hfill command gives you a nice spacing between the figures.

\begin{figure}[htp]
\centering
\includegraphics[width=0.4\textwidth,viewport=50 260 400
1000,clip]{erptsqfit}
\hfill
\includegraphics[width=0.4\textwidth,viewport=50 260 400 1000,clip]{erptsqfit}\\
\includegraphics[width=0.4\textwidth,viewport=50 260 400
1000,clip]{erptsqfit}
\hfill
\includegraphics[width=0.4\textwidth,viewport=50 260 400 1000,clip]{erptsqfit}\\
\caption[Transverse momentum distributions - E-R model.]{Transverse momentum distributions - E-R model fit
(intercept 1.2).}\label{fig:erptsqfit}
\end{figure}

Subfigures

However, sub-figures using the subfigure package in LaTeX is really the way to do this!! This package come with the standard distribution of LaTeX, is called using

\usepackage{subfigure}

in the document preamble (i.e. before the \begin{document} command).A nice example of the use of this package to create a 2×2 figure is as follows

\begin{figure}%[htp]
     \centering
     \subfigure[Donnachie-Landshoff form factor model in Feynman gauge
     (solid line) and in non-covariant gauge (dashed line). Here
     $\Lambda=0.2\gev^2$ and $\intercept=1.08$.]{
          \label{fig:dl2858}
                \psfrag{ylabel}{$\frac{1}{\sigma}\frac{\rmd\sigma}{\rmd\ptsq}\gev^2$}
                \psfrag{xlabel}{\small{$\ptsq\gev^2$}}
          \includegraphics[width=.45\textwidth]{dlddlanalysis99fit2858loglin.eps}}
     \hspace{.3in}
     \subfigure[Ellis-Ross form factor model in Feynman gauge (solid
     line) and in non-covariant gauge (dashed line). Here
     $\Lambda=0.2\gev^2$ and $\intercept=1.08$.]{
          \label{fig:er2858}
                \psfrag{ylabel}{$\frac{1}{\sigma}\frac{\rmd\sigma}{\rmd\ptsq}\gev^2$}
                \psfrag{xlabel}{\small{$\ptsq\gev^2$}}
          \includegraphics[width=.45\textwidth]{erderanalysis99fit2858loglin.eps}}\\
     \vspace{.3in}
%     \hspace{.1in}
     \subfigure[Single-gluon exchange model (solid line) and Scalar
     Pomeron exchange model (dashed line).]{
           \label{fig:cminusscalar2858}
                \psfrag{ylabel}{$\frac{1}{\sigma}\frac{\rmd\sigma}{\rmd\ptsq}\gev^2$}
                \psfrag{xlabel}{\small{$\ptsq\gev^2$}}
           \includegraphics[width=.45\textwidth]
                {cminusscalaranalysis99fit2858loglin.eps}}
     \subfigure[Two-gluon exchange model.]{
           \label{fig:2glue2858}
                \psfrag{ylabel}{$\frac{1}{\sigma}\frac{\rmd\sigma}{\rmd\ptsq}\gev^2$}
                \psfrag{xlabel}{\small{$\ptsq\gev^2$}}
          \includegraphics[width=.45\textwidth]{2glueanalysis99fit2858loglin.eps}}
     \caption{Fit of pomeron models to Thrust Jet
           data\,\cite{Adloff:1997sc}. The fit is only made to points
           after the turn-over of the curves. Curves correspond to
           model fits, while solid points are H1 data. These plots
           show the fits for several models for diffractive masses in
           the region of $M_X=28.58\gev$. The statistical and
           systematic errors have been added in quadrature.}
     \label{fig:2858multifig}
\end{figure}    (source: http://www.hep.manchester.ac.uk/u/jenny/jcwdocs/latex/figures.html)

Posted in Study and research | Leave a Comment »

Grammy 2007

Posted by icecafe on February 11, 2008

Kết quả giải Grammy 2007:

1. Ghi âm của năm:

Irreplaceable – Beyonce.
ThePretender – Foo Fighters.
Umbrella – Rihanna và Jay-Z.
What Goes Around … Comes Around – Justin Timberlake.
Rehab – Amy Winehouse.

2. Album của năm:

Echoes, Silence, Patience & Grace – Foo Fighters.
These Days – Vince Gill.
River: The Joni Letters – Herbie Hancock.
Graduation – Kanye West.
Back to Black – Amy Winehouse.

3. Ca khúc của năm:

Before He Cheats – Carrie Underwood.
Hey There Delilah – Plain White T”s.
Like a Star – Corinne Bailey Rae.
Rehab – Amy Winehouse.
Umbrella – Rihanna Featuring Jay-Z.

4. Nghệ sĩ mới xuất sắc:

Feist – Ledisi – Paramore – Taylor Swift – Amy Winehouse.

5. Album nhạc pop xuất sắc:

Lost Highway – Bon Jovi.
The Reminder – Feist.
It Won”t Be Soon Before Long – Maroon 5.
Memory Almost Full – Paul McCartney.
Back to Black – Amy Winehouse.

6. Album nhạc rock xuất sắc:

Daughtry – Daughtry.
Revival – John Fogerty.
Echoes, Silence, Patience & Grace – Foo Fighters.
Magic – Bruce Springsteen.
Sky Blue Sky – Wilco.

7. Album R&B xuất sắc:

Funk This – Chaka Khan.
Lost & Found – Ledisi.
Luvanmusiq – Musiq Soulchild.
The Real Thing – Jill Scott.
Sex, Love & Pain – Tank.

8. Album nhạc rap xuất sắc:

Finding Forever – Common.
Kingdom Come – Jay-Z.
Hip Hop Is Dead – Nas.
T.I. vs T.I.P. – T.I..
Graduation – Kanye West.

9. Album nhạc đồng quê xuất sắc:

Long Trip Alone – Dierks Bentley.
These Days – Vince Gill.
Let It Go – Tim McGraw.
5th Gear – Brad Paisley.
It Just Comes Natural – George Strait.

10. Album pop latin xuất sắc:

Papito – Miguel Bose & Varios Artistas.
12 Segundos De Oscuridad – Jorge Drexler.
Navidades Luis Miguel – Luis Miguel.
Dicen Que El Tiempo – Jennifer Pena.
El Tren De Los Momentos – Alejandro Sanz.

11. Album nhạc jazz xuất sắc:

Party Hats – Will Bernard.
Downright Upright – Brian Bromberg.
Re-imagination – Eldar.
River: The Joni Letters – Herbie Hancock.
He Had a Hat – Jeff Lorber.

12. Ca khúc nhạc pop xuất sắc của nữ ca sĩ:

- Candyman – Christina Aguilera.
- 1234 – Feiss.
- Big Girls Don”t Cry – Fergie.
- Say It Right – Nelly Furtado.
- Rehab – Amy Winehouse.

13. Ca khúc nhạc pop xuất sắc của nam ca sĩ:

- Everything – Michael Buble.
- Belief – John Mayer.
- Dance Tonight – Paul McCartney.
- Amazing – Seal.
- What Goes Around…Comes Around – Justin Timberlake.

14. Ca khúc nhạc pop xuất sắc của nhóm nhạc hoặc song ca:

- (You Want To) Make A Memory -Bon Jovi.
- Home – Daughtry.
- Makes Me Wonder – Maroon 5.
- Hey There Delilah – Plain White T”s.
- Window In The Skies – U2.

15. Ca khúc nhạc rock đơn ca xuất sắc:

- Timebomb – Beck.
- Only Mama Knows – Paul McCartney.
- Our Country – John Mellencamp.
- Radio Nowhere – Bruce Springsteen
- Come On – Lucinda Williams.

16. Ca khúc nhạc rock song ca hoặc ban nhạc xuất sắc:

- It”s Not Over – Daughtry.
- Working Class Hero – Green Day.
- If Everyone Cared – Nickelback.
- Instant Karma – U2.
- Icky Thump – The White Stripes.

(NetLife)

Posted in Misc | Leave a Comment »

Install Windows XP in SATA drives solution

Posted by icecafe on February 8, 2008

I have met this problem and searched for some solutions in the Internet as follows.

1. Problem description:

One of the most popular topics among our readers is installing Windows XP on your new Windows Vista computer – sometimes for compatibility reasons, but also because a lot of people just don’t like Vista very much.

The problem that people keep running into left and right is getting to the point where XP starts to install and getting the message “Setup did not find any hard disk drives installed in your computer”. This error happens because your new computer has a storage controller that isn’t supported natively in XP, usually an SATA (Serial ATA) controller.image

Everyone is so used to IDE drives being auto-detected during install, that people naturally assume the same thing will happen with SATA drives, which can’t be further from the truth. SATA and SAS drives are closer to SCSI in reality, and thus will require their own drivers to be recognized by Windows XP, because the XP kernel predates when SATA drives were available. Vista addresses this issue and sees the SATA drives just fine because it has the drives built in already. The same problem existed back then on NT systems, where you had to push F6 to get it to see SCSI drives.

2. Solutions:

2.1 If you don’t have a floppy drive in your computer (who does anymore), then you’ll need to use a process called slip-streaming to integrate the storage drivers into your XP installation CD.

It should go without saying that this is an advanced topic, so proceed with caution.

Creating a Custom XP Install

We’ll use a software called nLite to create a new XP install cd, so you’ll first need to download and install it. Once it starts up, you’ll be prompted for your Windows installation, so you’ll want to click the Browse button.

image

First you’ll be prompted for the “Windows installation”, which really means your XP install CD. Find it and select the root of the installation, and then click OK to go to the next dialog.

image

Next you’ll be prompted on where you want to save the temporary files used during the slip-streaming process. I chose to create a new directory and called it XPISO, but you can put it wherever you’d like. I just recommend to use a new directory.

image

nLite will copy all the necessary files off the XP installation and into the temporary folder. When it’s done, you’ll see all the information on which version it is.

image image

Hit the next button until you come to this screen, where you can select what options you want. Select “Drivers” and then “Bootable ISO”.

image

Side note: You can select any of the other options if you’d like. nLite will let you bundle updates, set tweaks or automatically remove components from the installation, but that all goes beyond the scope of this article.

Hit the next button until you get to the screen for selecting drivers. If you click the Insert button, you can choose between adding a single driver or adding a folder of drivers. Since we’ll just be loading a single driver, you can choose that option, but you might want to first read the section below about finding drivers for XP.

image image

Browse to the directory where you extracted the driver files, and then select Open. Note that it doesn’t really matter which of the *.inf files you choose, because it will select all files in the folder anyway.

image

nLite will prompt you to select your driver. If you don’t know which exact one it is, you can either use Device Manager in Vista to find the exact model, or you can just select all of them. Just be careful not to select a 64-bit driver if you are using 32-bit, or the wrong OS version.

image

I would recommend including both Storage and Network drivers, as those are the most common drivers that are missing in XP. image

Once you proceed to the next screen, now we can finally finish the process. You can choose to directly burn the cd here, or you can select Create Image to create an ISO file that you can burn to a CD using whatever burning tool you have.

Note: If you chose to create an ISO, make sure to use the “Make ISO” button before you click Next.

imageimage

 

 

 

At this point you can burn the ISO image to a CD, and then start your XP installation process.

Finding Drivers for XP

The best place to search for drivers for your hardware is at the manufacturer’s support website. The only problem is that almost every manufacturer seems to distribute their drivers in floppy disk image form, even though the computer they are for doesn’t have a floppy drive. Guess nobody has alerted them to get with the program.

We can still extract the drivers using an application called WinImage. Let’s run through a quick example… Here you can see the Intel SATA controller driver for my HP computer.

image

I downloaded and ran the executable, which extracted a file called f6flpy32.exe into a temporary directory. Don’t bother trying to run this one, because it’ll just prompt you for a floppy drive.

image

So how to get the drivers out of this file? There are a few options that you can try, depending on how the manufacturer packed the files.

  • You can use Winimage to extract them, which is a shareware software, but you can use it during the trial period for free.

  • You can try and use WinRar to extract the file. In many instances this will extract a *.flp file, which you can mount in a VMware virtual machine or potentially with some ISO mounting software.

  • Some drivers will allow you to automatically extract into a directory. You’ll have to try it and see what happens.

  • Other methods? If you’ve got other ideas, leave them in the comments and I’ll add them to this list.

Here’s the list of files that Winimage can handle, which is quite a lot.

image

Start WinImage and then open the file, and you should see the contents. Just extract them to a folder, preferably with a useful name so you can remember it later.

image

Good luck with your installation, and be sure to leave any support questions on the forum.

Download WinImage from Winimage.com

Download nLite from nliteos.com

2.2 If you have a floppy drive in your compute, you can do similarly as a solution for Toshiba SATA driver:

http://www.csd.toshiba.com/cgi-bin/tais/su/su_sc_dtlView.jsp?soid=1128070

ISSUE

Microsoft Windows does not — as of October 2005 — have built-in support for Serial ATA (SATA) controllers and hard disk drives. This includes Windows XP (with or without SP1 or SP2) and Windows 2000. To install Windows on Toshiba computers with Serial ATA drives, it’s necessary to install the Toshiba RAID driver / Serial ATA driver during the Windows installation process.

RESOLUTION

Follow the procedure below to install Windows XP or Windows 2000 on a Toshiba computer with a Serial ATA hard disk drive. Windows can install the required driver only from a diskette drive. If the computer does not have an internal or external diskette drive, then Windows 2000 or Windows XP may be installed from the Recovery CD or DVD that’s packaged with the computer.
1. Click the following link to download the Toshiba RAID Driver / Serial ATA Driver.
2. Extract the seven driver files from the ZIP package to a folder on your desktop.
3. Copy the seven driver files to a blank diskette. Once the files have been copied, eject the diskette from the drive.
4. Insert the Windows XP or Windows 2000 CD into the computer’s CD drive and restart the computer.
5. Watch carefully, as the Windows installation progresses, and carefully read the text at the bottom of each screen. At the Windows Setup Screen (typically the second screen after installation starts) this message should appear at the bottom of the screen: “Press F6 if you need to install a third party SCSI or RAID driver.”
6. Press the F6 key.
7. At the next screen, press S to specify an additional device.
8. Insert the diskette containing the Toshiba RAID driver / Serial ATA driver. Leave this diskette in the drive during the entire Windows installation process, as it will be accessed several times.
9. When prompted to select a driver from the provided list, choose “Toshiba RAID Driver (Windows XP/2000)”. When messages appear regarding Windows Logo testing, click the Yes button to continue.
Once the driver has been installed, Windows will recognize the computer’s SATA hard drive.
10. Continue installing Windows XP or Windows 2000.

Posted in Software & hardware | Leave a Comment »

Chúc mừng năm mới Mậu Tý

Posted by icecafe on February 5, 2008

Năm mới xin gừi tới mọi người lời chúc: sức khoẻ, hạnh phúc, may mắn và thành công.

xuanvn.jpg

Sưu tầm được bài thơ:

Ông Đồ Già

Mỗi năm hoa đào nở
Lại thấy ông đồ già
Bày mực tàu giấy đỏ
Bên phố đông người qua

Bao nhiêu người thuê viết
Tấm tắc ngợi khen tài
“Hoa tay thảo những nét
Như phượng múa rồng bay”.

Nhưng mỗi năm mỗi vắng,
Người thuê viết nay đâu ?
Giấy đỏ buồn không thấm
Mực đọng trong nghiên sầu …

Ông đồ vẫn ngồi đấy,
Qua đường không ai hay.
Lá vàng rơi trên giấy,
Ngoài giời mưa bụi bay.

Năm nay đào lại nở,
Không thấy ông đồ xưa.

Những người muôn năm cũ,
Hồn ở đâu bây giờ ?

Vũ Đình Liên

Posted in Uncategorized | Leave a Comment »