Latex 关于排版的几个问题

1、Q:几个作者同时共享机构地址,怎么搞? 

A:拿ACM的模版为例, 

Yes, and we suggest you do the following… 

Insert this piece of coding just before the 

\begin{document}

 

like so…  

% \def\sharedaffiliation{% \end{tabular} \begin{tabular}{c}} % \begin{document}

 

and then adjust your particular ‘author block’ like so (example shown for 3 authors)… 

\title{Alternate {\ttlit ACM} SIG Proceedings Paper in LaTeX Format\titlenote{(Produces...}} \numberofauthors{3} % Three authors sharing the same affiliation. \author{ \alignauthor Ben King\\ \email{king@cs.berkeley.edu} % \alignauthor Georgia Tobin\\ \email{tobin@cs.berkeley.edu} % \alignauthor Gerald Murray\\ \email{murrray@cs.berkeley.edu} % \sharedaffiliation \affaddr{Department of Electrical Engineering and Computer Science } \\ \affaddr{University of California, Berkeley } \\ \affaddr{Berkeley, CA 94720-1776 } } % \maketitle

 

When compiled/previewed/rendered, this is the effect: 

 

2、Latex如何正确输入引号? 

答:Tab键上方(1键左边)的那个键,按两下,输入··,然后输入两个单引号”,就是左右双引号了。单引号同理啊。 

3、如何使得双栏文档保持底部对齐?特别是参考文献 

在LATEX 标准文档类中使用twocolumn 选项产生双栏格式文档的时候,如果一页的内容不足以排满页 面时, LATEX 的结果是先排满左栏,然后再排版右栏。这样就造成了两栏的长度不相等,底部不齐。很多 时候我们不希望这种排版结果。 这个问题只有在用标准文档类的twocolumn 模式的时候才会遇到,使用multicol 宏包就可以避免这个 问题(参见问题36 )。但是multicol 宏包也有一些缺点,例如不允许单栏的浮动对象(参见问题56 )。 要使标准文档类的twocolumn 模式下也能做到双栏底部对齐,可以通过手工调整分栏的位置。在 twocolumn 模式下\newpage 命令使LATEX 开始在新的一栏上排版,如果单前栏是左栏,就换到右栏上开始 排版。在合适的地方使用\newpage 命令可以使得双栏底部对齐(注意,不能用\clearpage 命令,这个命 令会开始在新的一页上排版,而不管当前在哪一栏上)。几乎没有人愿意使用这种方法,不仅因为它需要 你手工计算需要插入命令的位置,每次改动文档都有可能需要变动\newpage 命令的位置,而且对于一些自 动生成的文档内容(例如参考文献和索引),要插入\newpage 命令十分困难。 °ushend 宏包通过修改LATEX 核心定义来解决这个问题。使用它提供的\flushend 命令可以使得双栏底 部对齐,而\raggedend 命令则取消底部对齐。\flushend 命令会在宏包装入的时候自动运行。°ushend 宏 包只对文档最后一页有效,也就是说所有中间的强制换页,或者章节的自动换页导致的双栏底部不齐现象 都无法解决。 balance 宏包是另外一个更好的方法。它比balance 更加完善,而且对整个文档的任何位置都有 效。balance 宏包提供了\balance 命令来打开双栏底部对齐机制, \nobalance 命令来关闭这个机制。和 °ushend 宏包不同,它在装入的时候缺省不打开对齐机制,因此需要在文档中加入\balance 命令来启用底 部对齐。 在使用这些宏包的时候需要注意,单栏的浮动对象有可能破坏这些宏包的对齐机制。这种时候需要手 工调整浮动对象的位置来改善排版效果。这也是multicol 宏包不支持单栏浮动对象的原因之一。 

4、Latex怎么对算法进行排版? 

排版可能需要的包: 

\usepackage{algorithm}               //format of the algorithm 

\usepackage{algorithmic}             //format of the algorithm 

\usepackage{multirow}                //multirow for format of table 

\usepackage{amsmath} 

\usepackage{xcolor} 

\DeclareMathOperator*{\argmin}{argmin}         //argminargmax公式的排版 

\renewcommand{\algorithmicrequire}{\textbf{Input:}}   //Use Input in the format of Algorithm 

\renewcommand{\algorithmicensure}{\textbf{Output:}}  //UseOutput in the format of Algorithm 

排版图片可能需要的包: 

\usepackage{graphics} 

\usepackage{graphicx} 

\usepackage{epsfig} 

算法的排版举例: 

\begin{algorithm}[htb]         %算法的开始 

\caption{ Framework of ensemble learning for our system.}             %算法的标题 

\label{alg:Framwork}                  %给算法一个标签,这样方便在文中对算法的引用 

\begin{algorithmic}[1]                %不知[1]是干嘛的? 

\REQUIRE ~~\\                          %算法的输入参数:Input 

    The set of positive samples for current batch, $P_n$;\\ 

    The set of unlabelled samples for current batch, $U_n$;\\ 

    Ensemble of classifiers on former batches, $E_{n-1}$; 

\ENSURE ~~\\                           %算法的输出:Output 

    Ensemble of classifiers on the current batch,  $E_n$; 

\STATE Extracting the set of reliable negative and/or positive samples $T_n$ from $U_n$  with help of $P_n$; \label{code:fram:extract}      %算法的一个陈述,对应算法的一个步骤或公式之类的; \label{ code:fram:extract }对此行的标记,方便在文中引用算法的某个步骤 

\STATE Training ensemble of classifiers $E$ on $T_n \cup P_n$, with help of data in former batches; \label{code:fram:trainbase} 

\STATE $E_n=E_{n-1}\cup E$; \label{code:fram:add} 

\STATE Classifying samples in $U_n-T_n$ by $E_n$; \label{code:fram:classify} 

\STATE Deleting some weak classifiers in $E_n$ so as to keep the capacity of $E_n$; \label{code:fram:select} 

\RETURN $E_n$;                %算法的返回值 

\end{algorithmic} 

\end{algorithm} 

在文中对算法和算法的某个步骤的引用:Therefore, in step \ref{code:fram:extract} of algorithm \ref{alg:Framwork}, we extract $T_n$, a set of reliable negative samples 

1、  ForWhile循环语句的排版举例 

(1)       排版效果图 

(2)       排版代码 

\begin{algorithm}[h] 

    \caption{An example for format For \& While Loop in Algorithm} 

    \begin{algorithmic}[1] 

        \FOR{each $i\in [1,9]$} 

            \STATE initialize a tree $T_{i}$ with only a leaf (the root);\\ 

            \STATE $T=T\bigcup T_{i};$\\ 

        \ENDFOR 

         

        \FORALL {$c$ such that $c\in RecentMBatch(E_{n-1})$} \label{code:TrainBase:getc} 

            \STATE  $T=T \cup PosSample(c)$; \label{code:TrainBase:pos} 

        \ENDFOR; 

         

        \FOR{$i=1$; $i<n$; $i++$ } 

            \STATE $//$ Your source here; 

        \ENDFOR 

         

        \FOR{$i=1$ to $n$} 

            \STATE $//$ Your source here; 

        \ENDFOR 

         

        \STATE  $//$ Reusing recent base classifiers. \label{code:recentStart} 

        \WHILE {$(|E_n| \leq L_1 )and( D \neq \phi)$} 

            \STATE  Selecting the most recent classifier $c_i$ from $D$; 

            \STATE  $D=D-c_i$; 

            \STATE  $E_n=E_n+c_i$; 

        \ENDWHILE \label{code:recentEnd} 

         

    \end{algorithmic} 

\end{algorithm} 

5、图片或者表格的里是有标记脚注的“1”和“2”了,但是页面下没有脚注…… 

答案:[一]    在tabular 环境中添加脚注,不能简单地使用\footnote{……}。应该在要添加脚注的地方使用\footnotemark[n]标记,其中n表示脚注的编号;在tabular环境外则用\footnotetext[n]{……}填入脚注内容,注意这里的[n]应该与表格中的\footnotemark中的 [n]一一对应。 示例:

\begin{tabular}{|c|c|c|} \hline 类型名称&占用空间&表示范围\ \hline real&6字节\footnotemark[3]&.9 \times 10^{-39} \sim 1.7 \times 10^{38}$\ \hline single&4字节&.5 \times 10^{-45} \sim 3.4 \times 10^{38}$\ \hline double&8字节&.0 \times 10^{-324} \sim 1.7 \times 10^{308}$\ \hline extended&10字节&.4 \times 10^{-4932} \sim 1.1 \times 10^{4932}$\ \hline \end{tabular} \footnotetext[3]{在~Free Pascal~中,real~类型可以自动转换成~single~或~double~类型,所以占用的空间大小也不固定。}

[二] 使用\footnotemark在表格中插入脚注符号,然后在表格外面使用\footnotetext命令写入脚注文字。如果在表格中多次使用了 \footnotemark,在表格外面需要使用\addtocounter和stepcounter命令为每个脚注写入文字。参考下面的代码:Reference 

 

begin{footnotesize} \begin{table}[htbp] \centering \renewcommand{\baselinestretch}{1.5} \fontsize{9pt}{9pt}\selectfont \caption{Test results} \begin{tabular}{c @{} c  c  c  c @{} c @{} c @{} c } \hlinewd{1.5pt} Test No.     & Liner    & Target     & \multicolumn{2}{c}{Cumulative damage}  & Diameter of & Hit density around  & Ejection angle \\              & angle    & distance   & \multicolumn{2}{c}{region (ellipse)}   & the dense   & the cumulative      & of fragment in \\ \cline{4-5}  & /degree  & /m         & Major axis    & Minor axis             & fragment    & damage region       & the focused    \\              &          &            & /mm           & /mm                    & region/mm   & /(pieces/m$^{2}$)   & region/degree  \\ \hlinewd{0.75pt} 2001-6-5-1& 10& 1& 185& 150& 525& 1017(9100 in the hole)\footnotemark & 9.5 \\ 2001-6-5-2& 10& 2& 160& 155& 360& 1565\footnotemark &4.5 \\ 2001-6-5-3& 20& 3& 150& 110& 210& 3443&4.0 \\ 2001-6-6-1& 20& 5.25& 122& 70& 235& 3708&2.5 \\ 2001-6-6-2& 30& 4& 96& 82& 290& 3633&4.1 \\ 2001-6-6-3& 30& 6& 78& 47& 320& 3385&3.1 \\ \hlinewd{1.5pt} \end{tabular} \label{Tab:2.1} \end{table} \end{footnotesize} 

\addtocounter{footnote}{-1} \footnotetext{Since the distance was only 1m, almost all the fragments hit the target, so that the hit density of that test in the cumulative damage region can be estimated.} \stepcounter{footnote}\footnotetext{1565.} 

  6、如何生成固定宽度的表格?

在LATEX 中生成固定宽度的表格有两种方法,一种是通过扩展列之间的空隙,另一种是扩展某些指定 的列。 第一种方法通过tabular* 环境来实现。在tabular* 环境的第一个参数中指定表格的总宽度,然后在 表格的列格式参数中使用\extracolsep 命令来增加列之间的空隙。 \begin{tabular*}{5cm}{@{\extracolsep{\fill}}lllr} \hline 1 & 2 & 3 & 4 \\ 21 & 22 & 23 & 24 \\ \hline \end{tabular*}

这种方法的一个缺点是列之间如果加入分隔符,则列之间的空隙是放在下一列的左边而不是在两列之间平 均分配。我们来看上面的例子加入分隔符后的样子 \begin{tabular*}{5cm} {@{\extracolsep{\fill}}|l|l|l|r|} \hline 1 & 2 & 3 & 4 \\ 21 & 22 & 23 & 24 \\ \hline \end{tabular*}

另一种方法可以通过使用tabular 环境的列格式参数之一ph宽度i 来指定相应列的固定宽度。这种方法 需要用户手工计算分配每个列的具体宽度。另外,由于p 参数不能和其他控制对齐方式的参数同时作用在 一个列上,因此需要使用额外的方法来控制这些列的对齐方式(参见问题53 )。 tabularx 宏包提供了一个自动计算分配列宽度的表格环境tabularx 。这个环境的使用方法和tabular* 相同。不同之处在于它增加了一个X 参数。所有使用X 参数的列会平均分配多余的空间,然后转换为p 参数来指定列的宽度。该宏包也提供了方法让你可以指定如何转换或者转换为其他的列参数。该宏包需要 array 宏包的支持。 ltxtable 宏包则结合了longtable 和tabularx 宏包的特点。但是它的用法有点复杂,请仔细阅读它的文 档。

7、关于论文最后参考文献两栏对齐,长度一样的问题?

答:\usepackage{balance}

拿ACM的论文模板为例:

\bibliographystyle{abbrv} \balance \bibliography{sigproc}

====================

8、argmax argmin 上标和下标

Usage:
\mathop{\arg\min}_{[subs]} \mathop{\arg\max}_{[subs]} Example:
\mathop{\arg\min}_{\tilde{X}, \tilde{Y}, \tilde{Z}} \mathfrak{J} .
Reference:
http://bbs.ctex.org/viewthread.php?tid=50467

posted on 2013-09-11 20:46  淘小豆儿  阅读(1207)  评论(0)    收藏  举报

导航