Monday, November 5, 2012

Latex: Reference to subfigure or subfloat but only with letter

You got a subfloat in latex and want a reference to it without printing e.g. "1.1a" but only "a".
Simply use \subref instead of \ref.

If you want to use this in a caption itself, try the \protect\subref{} command!

Saturday, September 1, 2012

Latex: Okular not showing figures in DVI file on Windows

If Okular does not show you the embedded EPS files of your compiled latex document it might be, that ghostscript is missing or is not found.
Install ghostscript (simple google search) and add <ghostscriptinstallpath>/bin to your system or user path.

Next time you open Okular it should display your images within DVI

Tuesday, May 15, 2012

LATEX: Texniccenter and Okular forward and reverse search

Proper configured Texniccenter for dvi , dvi > ps and dvi > ps > pdf output.
Kde for Windows with Okular.

Latex->DVI profile,
  • Latex ribbon, Arguments for compiler:
    --src -interaction=nonstopmode "%Wm" -synctex=-1
  • Viewer ribbon:
    Application path > C:\ProgramData\KDE\bin\okular.exe
    Command Line Arguments: '%bm.dvi#src:%l %Dc/%nc' --unique
    Search in output: '%bm.dvi#src:%l %Dc/%nc' --unique
    Do not close
Extension to PS and PDF should be straightforward.

Okular reverse search:
Setting > Configure Okular > Editor:
  • Dropdown box: Custom Text Editor
  • Command:"C:\Program Files (x86)\TeXnicCenter\TEXCNTR.exe" /ddecmd "[goto('%f', '%l')]"
Note that you have to adjust the paths, e.g. "c:\..." to your custom installation.

Monday, April 2, 2012

LATEX: Automated Pagecounter between two labels

To have an automated and updated counter of your pages between two labels you can use the following commands/packages:

Place in main document:

 \COMMENT{ \number\numexpr\getpagerefnumber{#2}-\getpagerefnumber{#1}\relax}}

To print a page difference:

Thursday, March 29, 2012

LATEX: Hide column in table

Very nice. I forgot where I found it:

\newcolumntype{I}{@{}>{\ignore}l<{\endignore}} %% blind out some colums

Now a table column with the letter "I" instead of c,r,l  will be hidden.
Of course there is a little extra space left

Needs the package:


Friday, March 23, 2012

KILE: Workaround for forward search in Windows

The KILE builtin functionality currently adds as space and "./" to the source file when clicking ForwardDVI under windows with the current KDE Windows release. I do not have this behavior in Linux Ubuntu 10.04 with latest patches installed.
Still, this annoys  me and I came up with a workaround for Windows:

You need:

  • Cygwin with sed installed
  • Okular (any other dvi viewer should do fine)

Generate a build command in Kile-> Settings -> Configure Kile --> Build which is exactly the same as ForwardDVI.
Than change this new command to the following:

Command: cmd
Options: /c open_okular.bat '%target'

This should call the batch file open_okular.bat within the DOS CMD shell and pass along the string containing everything you need for doing forward search.

Now place the following DOS CMD script in your TEX Project Root folder:
FILE open_okular.bat

echo "Start"
set PATH=%PATH%;c:\programdata\kde\bin\;c:\cygwin\bin\;c:\Users\<username>\kderoot\bin\
echo  %INPUT%
for /f %%a in ('echo %1 ^| sed.exe -e"s/ \.\///"') do set OUTPUT=%%a
@echo %OUTPUT%
okular.exe %OUTPUT% --unique
echo "End"

What the script does:
Line 2 updates your path so that okular.exe and sed.exe are known. Adjust paths appropriatley
Line 4 removes the " ./" in words: space dot slash; from the string and stores it in OUTPUT
Line 6 calls okular with the new string.

This should give you the forward search for Kile and Okular in Windows.
Adoptions to any other DVI viewer should be straight forward.
Adoptions to Linux should be easy as string manipulation is usually a lot easier.

KILE: Document Variables or Build wildcards

Document variables or Build wildcards of kile are not documented anywhere to my knowledge and I just found this POST which basically says the same!

So here is a quick overview copied from the site above:

The variables have the following meanings:
%source -> filename with suffix but without path <-> myBestBook.tex
%S -> filename without suffix but without path <-> myBestBook
%dir_base -> path of the source file without filename <-> /home/user/latex
%dir_target -> path of the target file without filename, same as %dir_base if 
no relative path has been set <-> /home/user/latex
%target -> target filename without path <-> without filename 

And these are special variables
%res <-> resolution of the quickpreview action set in configure 

%AFL <-> List of all files in a project marked for archiving. You can set the 
archive flag in the "Files and projects" sidebar using the context menu.

Currently, my KILE setup is not using the correct way to call okular to jump to the correct line viewed as tex source. The wildcard %target produces the following output:

Target.dvi#source:120 Source.tex

However, there should not be a space between 120 and Source. Without this space it is working well from command line.
However I lack the variables for linenumber and source document and so I stuck. Any Ideas for solving this particular problem?

Tuesday, March 13, 2012

VisualStudio: LINK : fatal error LNK1105: cannot close file

The error:

LINK : fatal error LNK1105: cannot close file 

occurs a lot to me working on Network shares or shared folders in Virtual Machine.
In particular this error came out of nowhere in my VirtualBox Win7 System, running on a Ubuntu 10.04 host.
Fortunately, the solution was easy. Just install the current VirtualBox Addon Tools and after a restart the error was gone.
My Versions now:

Virtual Box: 4.1.8
Addons: 4.18

Of course, this error is obvious. Nevertheless, I do not care if my VirtualBox updates itself or not. I just want it running.

Saturday, February 18, 2012

Tools: Latex: Texnic Center and Okular forward search

Put the following command in your Tex->DVI Viewer config under command for opening and forward search:

'%bm.dvi#src:%l %Dc/%nc' --unique

%bm.dvi is your output filename of the Project.
#src:%l gives the linenumber of the current curson
%Dc gives the complete path to the current source file with slashes
%nc gives the full name of the current source file.
--unique ensures only one Okular instance is opened.

Please be sure to use single quotes as double quotes produced no search in my case.

So far I noticed that it does not work if you have lines with latex commands only, e.g. \begin{itemize} or latex TOC elements, e.g. \section{Introduction}.
Just go to the nearest written text section.

Friday, February 17, 2012

CUDA: API Call Doxygen Documentation

Full online documentation of all CUDA API calls

CUDA: Accessing pinned/pagelocked memory from different threads

Some time ago I asked the question here:

on how to access pinned or pagelocked memory from two threads in the same program.

The key is to allocate with the portable attribute.
Look at:
Nvidia Doxygen 4.0 cudaHostAlloc

for details.

Even more elegant is however, to register the memory only if you need it:
See details about  cudaHostRegister cudaHostRegister cudaHostUnregister at:
Nvidia Doxygen 4.0 cudaHostRegister

Monday, February 13, 2012

Tools: Office 2010 Print to File

It took me some time to actually find this well known Option. If you are in Excel or any other Office program you see this option well down  below the combo-box where you chose the Printer.

However, in Outlook 2010 it is on the initial Print Page.

Monday, February 6, 2012

GIT: DIFF working tree against some revision or branch

git diff  fw7e7f8wef8wef yourfile.c


Gives the changes between current working dir and revision  or branch: fw7e7f8wef8wef

Wednesday, February 1, 2012

Fully reviewed journal publications

  • J. Habich, C. Feichtinger, H. Köstler, G. Hager, G. Wellein: Performance engineering for the Lattice Boltzmann method on GPGPUs: Architectural requirements and performance results, Computers & Fluids, Available online 27 February 2012, ISSN 0045-7930, 10.1016/j.compfluid.2012.02.013.

  • C. Feichtinger, J. Habich, H. Köstler , G. Hager , U. Rüde, G. Wellein: A flexible Patch-based lattice Boltzmann parallelization approach for heterogeneous GPU–CPU clusters, Parallel Computing, Volume 37, Issue 9, September 2011, Pages 536-549, ISSN 0167-8191, 10.1016/j.parco.2011.03.005.

  • J. Habich, T. Zeiser, G. Hager, G. Wellein, Performance analysis and optimization strategies for a D3Q19 Lattice Boltzmann Kernel on nVIDIA GPUs using CUDA, In Special issue of "Advances in Engineering Software and Computers & Structures".

  • J. Habich, T. Zeiser, G. Hager, and G. Wellein: Speeding up a Lattice Boltzmann Kernel on nVIDIA GPUs. In Proceedings of PARENG09-S01, the First International Conference on Parallel, Distributed and Grid Computing for Engineering, Pecs, Hungary, April 2009.

Tuesday, January 31, 2012

GIT: Tag particular commit

Simply use git tag as usual but provide a valid commit hash:


git tag -a v1.0  cc622186a7322713f0ee4df8d58a1adcfe2ffef6   -m"tag a particular commit"