sidenote

Archívum
A(z) „alkotunk” kategória bejegyzései

Using a makefile for large LaTeX projects is a real time saver if you don’t use LaTeX IDEs (e.g. Texmaker, TeXworks). For example some of my friends have to log in to a central server, which provides the same LaTeX setup for everyone in their institution, to compile their documents. In this particular case using make is a must do! thing if you don’t want to fiddle around keeping track of which was the last command you executed or is your pdf up to date.

So, what are these makefile and make things?

Make is a tool which controls the generation of executables and other non-source files of a program from the program’s source files.

Make gets its knowledge of how to build your program from a file called the makefile, which lists each of the non-source files and how to compute it from other files. When you write a program, you should write a makefile for it, so that it is possible to use Make to build and install the program.

[…]

Make figures out automatically which files it needs to update, based on which source files have changed. It also automatically determines the proper order for updating files, in case one non-source file depends on another non-source file.

GNU Make

Here is my standard makefile template for projects utilizing pdflatex and bibtex (also downloadable at the end of the post):

# Makefile for my LaTeX project

# LaTeX
LC=pdflatex

# Bibtex
BC=bibtex

# The main tex file (without extension)
MAIN=main

# The tex files that are included in the project's main tex file
DEPS=./tex/chapter1.tex ./tex/chapter2.tex ./tex/chapter3.tex

MIDTARGET=$(MAIN).pdf

# The desired filename
TARGET=myprojectv01.pdf

.PHONY: clean show all

all: $(TARGET)

$(TARGET): $(MIDTARGET)
	cp $(MIDTARGET) $(TARGET)

$(MIDTARGET): $(MAIN).tex $(MAIN).aux
	$(BC) $(MAIN).aux
	$(LC) $(MAIN).tex
	$(LC) $(MAIN).tex

$(MAIN).aux: $(MAIN).tex $(DEPS)
	$(LC) $(MAIN).tex

show: $(TARGET)
	xdg-open $< &

clean:
	rm $(MAIN).out $(MAIN).aux $(MAIN).toc $(MAIN).lof $(MAIN).lot $(MAIN).log \
$(MAIN).bbl $(MAIN).blg $(MIDTARGET) $(TARGET)

I won't go into the details, but if you want to complement this makefile for using latex instead of pdflatex then you'll have to create another middle target for creating the dvi file. For those who'll use this makefile in a non-X environment don't use the show target beacuse xdg-open is meant to be used under X.

I think the GNU Make Manual is detailed enough to understand what I was talking about. But feel free to contact me if you have any questions.

Download: makefile.tar.gz

0 komment
Megosztás, like stb.

This is my submission for the Show Off Your Skillz in TeX & Friends Contest at TeX.sx.

Full LaTeX source and description coming soon below the picture.

% TypoTux
% Created by szantaii
% Compiled with pdflatex using TeX Live 2011
%
% Use it as you like, but please send me an e-mail if you do.

\documentclass[10pt,a4paper]{article}

% Specifying input encoding
\usepackage[utf8]{inputenc}

% Using the TikZ library for drawing Tux, and clipping
\usepackage{tikz}

% Loaded for unnumbered captions
\usepackage{caption}

% For inserting lorem ipsum text
\usepackage{lipsum}

% Setting baselines smaller
\setlength{\baselineskip}{6pt}

\begin{document}

%\lipsum[1]

\begin{figure}[h!]
\centering
\begin{tikzpicture}[y=0.80pt,x=0.80pt,yscale=-1, inner sep=0pt, outer sep=0pt,scale=0.25]
\begin{scope}[shift={(-249.6684,-294.38903)}]
%\begin{scope}[cm={{0.55569,0.0,0.0,0.55569,(249.6684,292.4824)}}]
\begin{scope}

% Tux's path used for clipping
% Generated with Inkscape / http://inkscape.org/
% Using the inkscape2tikz extension / http://code.google.com/p/inkscape2tikz/
\path[clip] (265.5000,1063.0000) .. controls (252.9000,1061.0000) and
% Tux's path used for clipping cut from here because it's too long to include.
% See link for full compilable source at the end of the post.

% Adding lorem ipsum text using TikZ nodes, and the lipsum package
\node[inner sep=0,text width=10cm] (text1) at (450,450) {\LARGE\textit{\lipsum[1]}};
\node[inner sep=0,text width=10cm] (text1) at (500,500) {\LARGE\textit{\lipsum[2]}};
\node[inner sep=0,text width=10cm] (text1) at (450,450) {\textit{\lipsum[3-4]}};
\node[inner sep=0,text width=10cm] (text1) at (500,500) {\textit{\lipsum[5-6]}};
\node[inner sep=0,text width=10cm] (text2) at (450,450) {\scriptsize\textit{\lipsum[7-11]}};
\node[inner sep=0,text width=10cm] (text2) at (475,475) {\scriptsize\textit{\lipsum[12-16]}};
\node[inner sep=0,text width=10cm] (text2) at (500,500) {\scriptsize\textit{\lipsum[17-21]}};
\end{scope}
\end{scope}
\end{tikzpicture}

\caption*{TypoTux}
\end{figure}

%\lipsum[2]

\end{document}

I have always wanted to create something like this. After I read about this contest I decided to make a Tux who’s drawn by text. I chose TikZ & PGF for this purpose since it’s very powerful, and I used it several times before for path clipping.

Step-by-step description how I made this:

  1. Grabbed a 2D vectorized Tux image from Wikipedia.
  2. Removed colored and unnecessary white paths from the image, resized page with Inkscape.
  3. Saved the black & white image as a standalone TikZ image with Inkscape using the inkscape2tikz extension.
  4. Removed some unnecessary paths from the tex source file, changed path filling to clipping.
  5. Added nodes filled with different size of lorem ipsum text using the lipsum package. Note: this was the hardest part, because there was no other way but trying to place the text under the clip path.
  6. A little bit of fancying, and cleaning up.

Use it for whatever you want to, but please let me know if you do. I compiled it with pdflatex using TeX Live 2011.

Full compilable source

0 komment
Megosztás, like stb.

A felső egy könyvből van, az alsót pedig én csináltam LaTeX-ben. Szerintem az enyém szebb. :) (Elnézést, ha hibás a cellulóz molekula, nem értek hozzá.)

Forrás alant, a chemfig csomag szükséges hozzá.

\setcrambond{3pt}{}{}
\setpolymerdelim{[}{]}
\chemfig[][]{HO-[:15](-[:-105](-[:-195]HO)<[:15](-[:-105,0.5]-[:-75,0.75]OH)-%
[:-15,,,,line width=3pt]O>[:75])-[:-15](-[:75]OH)-[:15]-[:-15]O-[:15]%
(-[:-15](-[:105,0.5]-[:75,0.75]OH)-[:15]O)<[:-75](-[:-195]HO)-[:15,,,,line width=3pt]%
(-[:-75]OH)>[:-15](-[:105,0.75])-[@{op,.75}:15]O-[:-15](-[:75](-[:195]HO)-[:-15]%
(-[:75]OH)-[:15])<[:15](-[:-105,0.5]-[:-75,0.75]OH)-[:-15,,,,line width=3pt]O>[:75]-%
[:-15]O-[:15](-[:-15](-[:105,0.5]-[:75,0.75]OH)-[:15]O)<[:-75](-[:-195]HO)-%
[:15,,,,line width=3pt](-[:-60]OH)>[:-15](-[:105,0.75])-[@{cl,.25}:15]O-%
[:-15](-[:75](-[:195]HO)-[:-15](-[:75]OH)-[:15])<[:15](-[:-105,0.5]-[:-75,0.75]OH)-%
[:-15,,,,line width=3pt]O>[:75]-[:-15]O-[:15](<[:-75](-[:-195]OH)-%
[:15,,,,line width=3pt](-[:-75]OH)>[:-15](-[:15]OH)-[:105,0.75])-[:-15]%
(-[:105,0.5]-[:75,0.75]OH)-[:15]O}
\makebraces[65pt,40pt]{n}{op}{cl}}
0 komment
Megosztás, like stb.

Ezt nemrég fejeztem be, full LaTeX:

Elég ronda ez a Google Docs Viewer, de nem kell aggódni, itt a pdf. Holnap szerintem submittelem a TeX showcase-be.

0 komment
Megosztás, like stb.

Mert nem tudtam aludni.

3 komment
Megosztás, like stb.

Éppen egy jegyzetet írok egy egyetemnek. Emiatt elég sokszor forgatom a Comprehensive LaTeX Symbol Listet, ugyanis nem fogok több száz szimbólumot megjegyezni csak azért, hogy két hét múlva ne emlékezzek rá.

Pár perce viszont rátaláltam a Detexify nevű szolgáltatásra, ahol semmi mást nem kell tenni, mint egy canvasra felrajzolni a keresett jelet, és máris kidobja a LaTeX megfelelőjét. Öcsém, ez mekkora találmány!

A szolgáltatás mögött álló Daniel Kirsch állítása szerint a cucc HTML5-öt használ, Firefox, Opera és Safari böngészőkben működik. Állati jó!

2 komment
Megosztás, like stb.

Nem is olyan rég csináltam egy mockupot, ami a leendő sidenote themét ábrázolta. Ma nekiálltam és meg is csináltam, amint láthatjátok. A WPSHOWER Blogum theméjét vettem alapul, gyakorlatilag azt alakítottam át. Elsőre ez biztos könnyűnek tűnik, de nekem közel sem volt olyan egyszerű, sokat melóztam vele, jórészt ezzel töltöttem 2010 két utolsó napját.

Remélem senkit nem rettent el a minimalista kinézet, de úgy gondoltam, ideje, hogy a sidenote új, felnőttesebb külsőt kapjon. Tetszéseteket vagy épp nemtetszéseteket természetesen kinyilváníthatjátok komment formájában. Előre is köszönöm, bármelyikről is legyen szó.

Ilyen volt, és ilyen lett:

Valószínűleg sok dolog lesz még, amin változtatnom kell, mert vagy kihagytam, elfelejtettem, vagy elrontottam. Ha találtok hibát, kérlek írjátok meg kommentben. Nagy segítség volna.

Boldog új évet nem kívánok, helyette inkább a hagyományos vulkáni köszöntéssel búcsúzom 2010-től:

Hosszú és eredményes életet!

9 komment
Megosztás, like stb.

szantaii:
azonnal posztolom.

> Petya:
> meg lennek hatva!
>
>> szantaii:
>> ezkurvajo! sidenote pozitiv?
>>
>>> Petya:
>>> csinaltam! humor!

Kösz, Petya.

1 komment
Megosztás, like stb.

Az előbb írtam egy rövid shell scriptet, ami nem csinál mást, mint egy könyvtáron belül (és annak az alkönyvtárain belül) levő fontokról a FontForge program fontimage appjával screenshotokat készít. Vagyis az összes betűtípusról egyszerűen és gyorsan lehet screenshotot csinálni.

Egyelőre csak a TrueType és az OpenType fontokról készít screenshotot, de gondolom a FontForge elboldogul mással is, a scriptben pedig csak egy regexpet kell átírni, hogy mást is támogasson. Hát nem csodás?! :) A forráskód alatti linken letölthető a cucc, de nyugodtan lehet kopipésztelni is.

#!/bin/bash

which fontimage > /dev/null

if [[ $? != 0 ]]
then
    echo "The fontimage program is needed to generate screenshots from fonts.
fontimage can be found either in the fontforge or in the fontforge-nox packages.
Or fontimage is not contained by your PATH enviroment variable."
    exit 1
fi

# fontscreenshot < directory >
function fontscreenshot()
{

    local DEFAULT_DIRECTORY="/usr/share/fonts/"

    local DIRECTORY=${1:-$DEFAULT_DIRECTORY}

    local FILE=""

    if [[ "$DIRECTORY" != */ ]]
    then
        DIRECTORY="${DIRECTORY}/"
    fi

    find "$DIRECTORY" -regex ".*\(otf\|ttf\)$" | while read FILE;
    do
        fontimage $FILE 2> /dev/null # error messages redirected to the void
    done
}

fontscreenshot $1

„Forráskód” targéza: fontscreenshot.

Konstruktív véleményeteket a hozzászólásoknál várom, és ha netán elrontottam volna valamit, akkor is toljatok egy kommentet, vagy bombázhattok emailekkel is (elérhetőség a Rólunk oldalon).

4 komment
Megosztás, like stb.

A tegnap esti vihar alatt, ami végre elérte Budapestet is, ezt az egy villámot sikerült elkapnom, pedig mentségemre legyen mondva, sokat próbálkoztam.

Az elmúlt néhány hétben többször próbáltam villámot fotózni, fél éjszakákat töltöttem a szabadban sikertelenül, aztán tegnap este az erkélyről mégis sikerült egyet elkapni. Nem lett ugyan a legjobb, de esett, párás volt a levegő és csak egy noname vacak fényképezőgép állt a rendelkezésemre. Ennyit tudtam kihozni belőle, remélem azért tetszik.

5 komment
Megosztás, like stb.