[ 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 Both sides next revision
tex:triky [2010/09/10 05:12]
bejcek crossreference TeX->PBML tricks
tex:triky [2010/12/14 17:32]
bejcek figures side-by-side
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> 
 +      \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.)       * (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)]]
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>
   * Useful **packages**:   * Useful **packages**:
     * Source printing: //''fancyvrb''//, //''listings''//     * Source printing: //''fancyvrb''//, //''listings''//

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