[ 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/07/02 18:36]
bejcek comparing two strings
tex:triky [2011/10/27 01:09]
bejcek tables and textwidth
Line 15: Line 15:
       * ''The variable \if#\variable# is empty.\else contains \variable.\fi''\\ (''\variable'' naturally cannot contain '''#'****'')       * ''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''       * ''The variable \ifx\@empty\variable is empty.\else contains \variable.\fi''
-    * **comparing** two strings:\\ ''\newif\ifsame\\ \newcommand{\strcfstr}[2]{%\\ \samefalse\\ \begingroup\\ \def\1{#1}\def\2{#2}%\\ \ifx\1\2\endgroup \sametrue\\ \else   \endgroup\\ \fi}'' +    * **comparing** two strings:<code> 
-      * (I don't know why the grouping is needed there...)+      \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)]]       * [[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''     * allocator **''\newif''** is used in a sequention:\\ a declaration ''\newif\ifsomething''\\ setting either ''\somethingtrue'' or ''\somethingfalse''\\ and asking ''\ifsomething YES\else NO\fi''
Line 28: 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 49: 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 ]