[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
tex:triky [2010/06/24 15:35]
stranak
tex:triky [2011/10/27 01:09]
bejcek tables and textwidth
Line 10: Line 10:
   * Useful page (and a figure) for **lists**:   * Useful page (and a figure) for **lists**:
     * http://latex.computersci.org/Reference/ListEnvironments     * http://latex.computersci.org/Reference/ListEnvironments
 +
 +  * The **if** condition in TeX:
 +    * construction **if ''\variable'' is empty**:
 +      * ''The variable \if#\variable# is empty.\else contains \variable.\fi''\\ (''\variable'' naturally cannot contain '''#'****'')
 +      * ''The variable \ifx\@empty\variable is empty.\else contains \variable.\fi''
 +    * **comparing** two strings:<code>
 +      \newif\ifsame
 +      \newcommand{\strcfstr}[2]{%
 +       \samefalse
 +       \begingroup
 +        \def\1{#1}\def\2{#2}%
 +        \ifx\1\2\endgroup \sametrue
 +        \else   \endgroup
 +        \fi
 +      }</code>
 +      * (The grouping is needed there to make '\1' and '\2' local but '\sametrue' global.)
 +      * [[http://www.tug.org/TUGboat/Articles/tb22-4/tb72wilson.pdf|(source, Peter Wilson)]]
 +    * allocator **''\newif''** is used in a sequention:\\ a declaration ''\newif\ifsomething''\\ setting either ''\somethingtrue'' or ''\somethingfalse''\\ and asking ''\ifsomething YES\else NO\fi''
  
   * **foreach** in TeX <html><font color="gray" size="-5">(thanks to TMA)</font></html>:   * **foreach** in TeX <html><font color="gray" size="-5">(thanks to TMA)</font></html>:
Line 19: Line 37:
  
   * **Aligning an element** in the line according to whether it fits in the rest of the line (TeX)   * **Aligning an element** in the line according to whether it fits in the rest of the line (TeX)
-      * always right-aligned <html><font color="gray" size="-5">(from Petr Olšák's TeXbook naruby)</font></html>: +      * always right-aligned <html><font color="gray" size="-5">(from Petr Olšák's TeXbook naruby)</font></html>:<code> 
-<code>       \def\alignelemright #1\par{\unskip+        \def\alignelemright #1\par{\unskip
           \nobreak\hfill\penalty71\hskip2em\hbox{}\nobreak\hfill           \nobreak\hfill\penalty71\hskip2em\hbox{}\nobreak\hfill
           \hbox{#1}\par}</code>           \hbox{#1}\par}</code>
-        * always left-aligned: +      * always left-aligned:<code> 
-<code>        \def\alignelemleft #1\par{\unskip+        \def\alignelemleft #1\par{\unskip
           \hbox{} \hskip 0pt plus 1fil \penalty0           \hbox{} \hskip 0pt plus 1fil \penalty0
           \hbox{#1}\hskip 0pt plus 1fill\hbox{}\par}</code>           \hbox{#1}\hskip 0pt plus 1fill\hbox{}\par}</code>
-      * align to the right, if it fits, or to the left in the new line: +      * align to the right, if it fits, or to the left in the new line:<code> 
-<code>       \def\alignelemrightorleft #1\par{\unskip+       \def\alignelemrightorleft #1\par{\unskip
           \nobreak\hfill\penalty71\hskip2em           \nobreak\hfill\penalty71\hskip2em
           \hbox{#1}\par}</code>           \hbox{#1}\par}</code>
 +  * Two **tables/figures side-by-side** [[http://texblog.wordpress.com/2007/08/01/placing-figurestables-side-by-side-minipage/|(source)]]:<code> 
 +    \begin{figure} 
 +     \begin{minipage}[b]{0.5\linewidth} 
 +      \centering \includegraphics[scale=1]{fn1} \caption{c} \label{f1} 
 +     \end{minipage} 
 +     \hspace{0.5cm} 
 +     \begin{minipage}[b]{0.5\linewidth} 
 +      \centering \includegraphics[scale=1]{fn2} \caption{c} \label{f2} 
 +     \end{minipage} 
 +    \end{figure}</code> 
 +  * **Include completed PDF** and add page numbers and other headings: ''\usepackage{pdfpages}''<code> 
 +    % settings 
 +    \markright{Author Name}    % or e.g. package fancyhdr 
 +    \setcounter{page}{13}      % number of first page 
 +    % inserting (first page with pagenumber in the foot, others in the head with author name) 
 +    \includepdf[pages=1, pagecommand={\thispagestyle{plain}}]{file.pdf} 
 +    \includepdf[pages=2-, pagecommand={\thispagestyle{myheadings}}]{file.pdf}</code> 
 +  * ''\textwidth'', ''\linewidth'', ''\columnwidth'', ''\hsize'' and others explained [[http://tex.stackexchange.com/questions/16942/difference-between-textwidth-linewidth-and-hsize|here]] 
 +  * ''longtable'' or ''xtabular'' environment **cannot** be inside ''table'' environment. (Put it inside ''center'' instead, since you cannot use ''\centering'' as before.)  
 +  * Useful **packages**: 
 +    * Source printing: //''fancyvrb''//, //''listings''// 
 +    * //''fancyhdr''// 
 +    * pseudocode //''algorithmicx''// 
 +    * trees: //''xytree''// (complicated), //''dtree''// (Obo, pstricks), //''xyling''// (Martin P., ''\B'' and ''\T'' must be relaxed) 
 +    * tables: //''xtab''// (better than ''longtable'' or ''supertabular''), //''tabulary''// (pretty wrapped text in autosized cells, similar to ''tabularx''), //''booktabs''// (no vertical lines, ''\toprule'', ''\midrule'', ''\bottomrule'' instead of ''\hline'') (all from this [[www.tug.org/pracjourn/2007-1/mori/mori.pdf|compendium]])
  
 ==== počítání slov (a dalších věcí) ==== ==== počítání slov (a dalších věcí) ====
Line 40: Line 82:
  
 Podrobnosti v dokumentaci: ''texdoc texcount'' Podrobnosti v dokumentaci: ''texdoc texcount''
 +
 +<html><hr/></html>
 +
 +Some PBML and SCTL-specific issues are [[https://wiki.ufal.ms.mff.cuni.cz/tex:pbml|here]].

[ Back to the navigation ] [ Back to the content ]