Showing posts with label IT. Show all posts
Showing posts with label IT. Show all posts

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:
MiKTeX
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.
Example:
  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]

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:

/System/Library/Filters

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".

Steps:

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.

Steps:
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
    .ClearFormatting
    .Text = ""
    .Style = "Caption"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute
  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
    .Find.Execute
  Loop
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.

Tuesday, February 24, 2015

Short DOS Readable File Name

Very simple application.. obtained the .BAT file somewhere.. credit to the contributor...

Instruction

1) Click Ctrl+R
2) Type "cmd"
3) Drag downloaded file, space
4) Paste the long file path desired
5) Enter/Return

Example:
C:\Users\Username\>C:\User\Username\Desktop\shortPathDOS.bat D:\SkyDrive\Installer\Somefilefolder\filenames.doc

Result:
D:\SkyDrive\INSTAL~1\Some file folder\file names.doc

Download file

Note: Rename the file extension to ".bat"

Thursday, February 19, 2015

Manjaro Series: Couldn't Update

Finally... after a few months (maybe) I didn't boot into manjaro... I booted up and tried to update...

However, I was welcomed with "signature from "Name " is unknown trust" error....!!! wtfish!!!


Luckily the solution is easy and only took a few steps... thank to the manjaro forum.

Meanwhile.... still installing updates.... 1GB worth update ;p

Monday, November 17, 2014

MS PPT Series: Export PPT background as a PPT background image

The easiest way is that you open a slide in PowerPoint and remove all the text or image content, so just leave the background in the slide. 
Then, go to Save As and choose JPG or PNG (or any other image format). Then, specify an output directory and save. 
You’ll be asked to choose to save a single slide or the entire document. Just choose Single Slide and then confirm.

Then use the output as a background image of your PPT slides. The steps are listed as follows:
  1. On the Design tab, in the Background group, click Background Styles, and then click Format Background.
  2. Click Fill, and then click Picture or texture fill.
  3. click File, and then locate and double-click the picture that you want to insert.
Done!!



Qiqqa Series: Small tweak in bibliography line break

Fine tune the look in the bibliography section will waste some of your precious time due to line break.. Here is a solution that worked for me...

A better solution that may work for some styles is to find the tag in your CSL file and add the two terms: 
entry-spacing="0" line-spacing="0" 

via [source]



Monday, September 29, 2014

MS Word Series: Texsword

In the previous article, I have introduced an add in called texsword. Besides using latex style to generate equation, you can also use its functionality to number your typed equation using MS Word.

The [square root button] in the texsword [add-ins] tab will produce a three columns table. The first column is for the equation, the second column is for the bookmark name and the third column for equation number.

Reset Equation Numbering


1) Press [Shift+F9] to show the field
2) Add [\r 1] in the field to reset the number to 1 or any intended number. For example {SEQ Eq \r 1} where SEQ is for sequence number and Eq is a variable used by texsword to name the equation.
3) Press [F9] to update

Add Heading To The Equation Number


1) Open texsword via open command in MS Word.
2) Press [Alt+F11] to bring up the VB Editor.
3) On the left side, double click on [Module -> texsword_equation] to bring up the codes.
4) Go to TeXsword_bookmark() subroutine and you will see codes

' Draw ()
    Selection.TypeText Text:="("
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
        "SEQ Eq", PreserveFormatting:=True
    Selection.TypeText Text:=")"
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveLeft Unit:=wdCharacter, Count:=3, Extend:=wdExtend

5) Change the codes as follows

' Draw ()
    Selection.TypeText Text:="("
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
        "STYLEREF \s ""Heading 1""", PreserveFormatting:=False
    Selection.TypeText Text:="."
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
        "SEQ Eq", PreserveFormatting:=True
    Selection.TypeText Text:=")"
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveLeft Unit:=wdCharacter, Count:=3, Extend:=wdExtend

The "Heading 1" can be changed to other headings when necessary.




MS Word Series: Working Smart With Alternative Equation Editor

Equation in MS Word


It is possible to transfer the equation created with TeXaide (refer to previous article) to MS Word or other word processor (I guess) by copy and paste special as picture. It is not possible to double click the picture to edit the equation. You have to edit the equation independently using TeXaide.

Alternatively, there are other "cool" tools out there to export LaTeX equation to MS Word such as:

  1. Texsword (my favorite)
  2. TexMaths
Texsword is targeted for MS Word user while TexMaths is for LibreOffice user. The functionality for both tools are equal in performance (based on my experience). The installation is easy and well explained in the documentation. The equation generated in the word processor is the same as TeXaide, an image.  However, for these tools, editing the equation can be easily done by double clicking the image and equation editor will appear. 

Now, choose the tool that best meet your expectation.

Texsword Installation For Windows 7


1) Go to [C:\Users\username\AppData\Roaming\Microsoft\Word\STARTUP], and put the texsword.dotm there.
2) Restart MS Word
3) You can see a new [add-ins] tab has been added. 


Happy "Equationing~"

MS Word Series: Editing Bookmark

It is easy to create or delete bookmark as explained in detail here.

It is however, possible to edit the created bookmark.

Steps:


1) Highlight new text/area
2) Go to Insert Tab -> Bookmark
3) Select the intended bookmark name
4) Click Add

Done!!

Thursday, September 18, 2014

XBMC: How to add icefilms

1. System
2. File Manager
3. Add source
4. Install from zip file
5. Enter "http://fusion.xbmchub.com"
6. Enter a name for this media source
7. Install from zip file
8. Click name entered in #6.
9. xbmc repos
10. ...anarchintost-projects..zip
11. Get Add-ons
12. Install what you want...

Friday, July 18, 2014

MS Word Series: Cross-reference with MS Word 2007

Preliminary article

Let say you want to cross-reference your fig. 1 in the body text.
But your inserted caption written as Figure 1.
MS Word 2007 does not allow you to insert only the number, so will get exactly Figure 1.

One way to work around this is by following steps.


  1. Press Alt+F9 to toggle the field codes.
  2. Insert \# "0" at the end of the codes.
  3. Do step 1 again.
  4. Press F9 to update.
and you're done!!

[Ref]

Tuesday, July 15, 2014

MS Word Series: Useful MS Word Shortcut You Wish To Know Earlier

Ctrl + Shift + Spacebar

Prevent words from being separated at the end of a line

Ctrl+Shift+Hyphen (Backslash, if JP keyboard) 

Hyphenated compound you don't want to break at the end of a line

Ctrl + Hyphen 

A conditional hyphen (one that is printed only if it falls at a line break)

Shift + Enter

Line break

Ctrl + Alt + V

Paste special

Alt + Ctrl + minus sign

An em dash

Ctrl + minus sign

An en dash

Ctrl + Spacebar

Remove character formatting

Ctrl + Alt + Home

Browse selection by Ctrl + Page Up/Down 

Ctrl + Shift + N

Apply normal style to the current paragraph 


Tuesday, July 8, 2014

LaTeX Series: Embed Font & Generating Correct Margin

For IEEE submission, the font have to be embedded into the file. However, usually latex will not embed fonts such as Times-Italic, Times-Roman, Times-BoldItalic, Times-Bold, Helvetica and Courier.

It can be easily fixed using Adobe pdf printer, however you need to have Adobe Pro. As an alternative way, you could use terminal or command window to generate the desired pdf by using commands below.

Command Window
dvilatex file.tex
bibtex file
latex file.tex
latex file.tex
dvips -Ppdf -G0 -tletter file.dvi 
ps2pdf -dCompatibilityLevel#1.4 -dPDFSETTINGS#/prepress file.ps file.pdf

Terminal
ps2pdf -dCompatibilityLevel=1.4 -dPDFSETTINGS#/prepress file.ps file.pdf
[Source]


The command:

dvips -Ppdf -G0 -tletter file.dvi

will generate a letter size output. You can change the desired size by the -t option such as a4 to generate A4 size output.

How to Solve Windows 7 Crashes

Refer to this link.

Tuesday, April 22, 2014

How To Convert EPS to PNG?

Sometimes, when writing scientific journal, the publisher requires you to submit figures in MS WORD file. For me, it would be troublesome as I always save my figure in EPS format to be used together with LaTeX.

Luckily, INKSCAPE can save you from creating the figure from scratch. Follow these steps for EPS to PNG conversion:

  1. Open Inkscape
  2. Click File -> Import
  3. Select .eps file
  4. Click File -> Export Bitmap..
  5. Select Drawing 
  6. Change Bitmap size to 300 dpi or any desired value
  7. Click Export