Tuesday, March 13, 2018

LaTeX Series: Local TeX Tree

1. Destination texmf-local: your local TeX tree

The first step is to determine in what directory the new font will live. You can't choose just any directory, it has to be part of the TeX hierarchy. The best choice is your “local texmf” tree, which you can determine as follows:
Navigate through the MiKTeX program:
Start > Programs > MiKTeX > Maintenance > Roots
(or MiKTeX Settings, in older versions). Some paths shown there have a Description such as InstallUserConfig, or UserData. A tree labeledUserConfig (but not any of the others) is an acceptable target for your new fonts, if you have no permission to create a new tree. However, it is better to use a tree without a description, as follows:You can create a new local tree by clicking on Add. The folder must not contain files at its root level or MiKTeX will reject it. Files in the folder must be in subfolders similar to the subfolders in the Install root. (MiKTeX info.)
TeX Live and MacTeX
From a system terminal (aka command prompt, shell window) enter the command kpsewhich --var-value TEXMFLOCAL to see the directory name. The default on Unix is /usr/local/texlive/texmf-local.
If you are not using one of the above TeX distributions, you'll need to consult other documentation.

2. Manual Package Installation

2.1 MikTex

If you want to install your own .sty files, then you should copy the files into the directory tex/latex/mystuff relative to a new TEXMF root directory.
  1. Create a new TEXMF root: mkdir ~/mytexmf
  2. Create a sub directory: mkdir -p ~/mytexmf/tex/latex/mystuff
  3. Copy your .cls and/or .sty files to ~/mytexmf/tex/latex/mystuff
  4. Register the TEXMF root directory ~/mytexmf
The last step can be carried out in MiKTeX Console.

2.2 TeX Live and MacTeX

The following are the steps that you should follow to install a new LaTeX package into your own home directory.
  1. Download the package file(s) from wherever they are available. Most packages are available from CTAN; enter appropriate keywords in the search fields to find the files.
  2. Packages may be distributed in different ways. Many packages on CTAN, for instance, come with a .dtx file and a .ins file. If the package you are installing comes with these files, you will have to process them with latex to create the actual files that make up the package. That is, type
    latex filename.dtx and/or latex filename.ins
    to unpackage the various .sty and other files in the package.
  3. Create a directory ~Library/texmf in your home directory, if there is not one there already.
  4. Install the various package files into subdirectories of texmf as follows:
    • All .bst and .bib files into texmf/bibtex (or subdirectories)
    • All font-related files into texmf/fonts (or subdirectories)
    • All documentation files into texmf/docs
    • All other files (.sty.cls.tex, etc.) should go into texmf/tex.
Alternatively, you could put all of the .sty etc. files into the same directory as the document you are editing. However, if you end up wanting to use them again later, you will have to copy them into the new directory as well, so in the long term it is probably better to put them into ~/texmf.

Source: [1, 2, 3, 4]

Monday, June 19, 2017

Balik Kampung

Lama dah tak pos entry....

kali ni note utk diri sendiri.... balik kampung!!!!

Friday, November 25, 2016

Mac Series: Reduce PDF File Size in Preview

zpjet has posted a very good article reproduce below:

I was never satisfied with results of "Reduce File Size" Quartz filter when trying to make some PDFs smaller before sending them by e-mail. It made them too small, and the graphics were fuzzy.

I eventually found where these filters are:


I was delighted to find out they're XML files easily editable with TextEdit (or any other text editor). I also found why this particular filter makes quite unusable PDFs, as these parameters were just too low:

Compression Quality 0.0
ImageSizeMax 512

So I copied this file to my Desktop, and then made two more copies of it, and called them Reduce File Size Good, Better and Best. Then I changed the parameters of each file to 0.25, 0.5 and 0.75 for Compression Quality, and used these three values for ImageSizeMax:

842 (that's A4 at 72dpi)
1684 (A4 at 144dpi)
3508 (A4 at 300dpi)

Finally, I changed the default string for the Name key at the end of each file to reflect the three settings, so they display the names I have given them in the menu.

Then I copied them to a /Library/Filters folder I created (for some reason, ~/Library/Filters doesn't work in Lion) and now when I open a picture or PDF in Preview, I have the option of four different qualities for reduced file sizes.

As an example, I have a JPEG of scanned A4 invoice at 300dpi and it's 1.6MB. When exporting to PDF in reduced size, the file is only 27 KB and it's quite unusable - very fuzzy and hard to read. The Good one is much easier to read, slightly fuzzy and still only 80 KB. Better is 420 KB and clear, and the Best is 600 KB and almost as good as the original even on a laser printer.

[kirkmc adds: Interesting hint. I see this as useful only for creating PDFs from files. If I'm scanning something, and I don't want the file to be too big, I'll either scan it at a lower resolution, or change the resolution in an image editor before making a PDF.]

Wednesday, October 5, 2016

Windows Series: Directory or Junctions?

When you created a "Junction", it will behave like you have all the files in that particular folder. However, the files actually located at other place (target folder).

There is no way to know whether the folder you look at is a "directory" or a "junction" using the windows explorer. There are alternatives however to differentiate them.

One way is by using the "Command Prompt".


1) Change the directory to the folder/directory of interest
2) dir /a to list all directory/junctions
3) dir /al /s to list all directory/junctions in the directory or subdirectories

Thanks to [source]

Tuesday, October 4, 2016

Windows Series: Junction

I worked across Windows-OS X, and several PC's...
Thus, I use dropbox to store my files; files anywhere across PC's and OS. ...

Using normal shortcut is not an option. Because OS X uses different kind of shortcut called alias which will not work on Windows. Similarly Windows uses .lnk (shell links) that will not work on OS X. On different PCs, the dropbox is installed on different drives (i.e. on PC1 E:\Dropbox, on PC2 F:\Dropbox) which will affect the shortcut created. It will not be accessible in PC2 if the shortcut created in PC1.

One of the solution is using "JUNCTION" which solved the problem that I've been facing across multiple PC/OS.

1) Run Command Prompt as administrator
2) mklink[space]/J[space]"link"[space]"target" (i.e. mklink[space]/J[space]"F:\Dropbox\TEACHING\SESI_2016-2017\ENT310_220\ASSESSMENTjunction"[space] "F:\Dropbox\UniMAP\TEACHING\MASTERFOLDER\ENT310_220\ASSESSMENT") 

Thanks to [source]

Friday, September 30, 2016

MS Word Series: Bold Caption Label & Number But Not The Caption Text

This macro is intended to BOLD the CAPTION LABEL & NUMBER but not the caption title.

Sub CaptionBoldNot()
' CaptionBoldNot Macro
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .Text = ""
    .Style = "Caption"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
  End With
  Do While .Find.Found
    With .Paragraphs.Last.Range.Duplicate
      .End = .Start + Len(Split(.Text, " ")(0)) + 1
      .MoveEndUntil " ", wdForward
      .Style = "Strong"
    End With
    .Collapse wdCollapseEnd
End With
Application.ScreenUpdating = True
End Sub

Thanks to the original author

Monday, March 21, 2016

MS Office Series: Equation/Math Font

The article here lists out the fonts available that look much better than Cambria Math.

In summary, three other nice fonts that work with Microsoft Office’s new Equation Editor (these are compatible with Office 2007 or later):
  • XITS Math is somewhat compatible with Times (download here).
  • Asana Math is compatible with Palatino (download here) and if you don’t have Palatino, you can download it here, among other places
  • Latin Modern is the LaTeX font of choice. There is a math font (download here) and a whole family of text fonts (download here). Note: these may not look good on screen, but they look just perfect when printed.