给定一个线程调用堆栈如下:
FATAL org.apache.hadoop.mapred.TaskTracker:
Error running child : java.lang.OutOfMemoryError: Java heap space
org.apache.hadoop.io.Text.setCapacity(Text.java:240)
at org.apache.hadoop.io.Text.set(Text.java:204)
at org.apache.hadoop.io.Text.set(Text.java:194)
at org.apache.hadoop.io.Text.<init>(Text.java:86)
......
at org.apache.hadoop.hive.ql.exec.persistence.RowContainer.next(RowContainer.java:263)
org.apache.hadoop.hive.ql.exec.persistence.Row Container.next(RowContainer.java:74)
at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.checkAndGenObject(CommonJoinOperator.java:823)
at org.apache.hadoop.hive.ql.exec.JoinOperator.endGroup(JoinOperator.java:263)
at org.apache.hadoop.hive.ql.exec.ExecReducer.reduce(ExecReducer.java:198)
......
at org.apache.hadoop.hive.ql.exec.persistence.RowContainer.nextBlock(RowContainer.java:397)
at org.apache.hadoop.mapred.Child.main(Child.java:170)
如何编写 latex 代码来实现以下效果。效果包括缩进、特定行自动加粗和等宽字体。请注意,如果论文是双栏样式,则生成的行应该能够跨越两栏。我试过 lstlisting,但字体和缩进都不好。
答案1
如果不标记,就不可能获得粗体(另一方面,我不明白何时选择粗体)。这里有一种方法可以得到你想要的。
\documentclass{article}
\usepackage{lmodern}
\newenvironment{javaerror}
{\ttfamily\list{}{\leftmargin=1em\itemindent=-1em\parsep=\parskip}%
\catcode`\.=\active
\begingroup\lccode`\~=`\.
\lowercase{\endgroup\def~}{.\penalty0 }%
\obeylines\raggedright\item\relax}
{\endlist}
\begin{document}
Some text before the error messages
some text before the error messages
some text before the error messages
\begin{javaerror}
FATAL org.apache.hadoop.mapred.TaskTracker:
\textbf{Error running child : java.lang.OutOfMemoryError: Java heap space}
\textbf{org.apache.hadoop.io.Text.setCapacity(Text.java:240)}
at org.apache.hadoop.io.Text.set(Text.java:204)
at org.apache.hadoop.io.Text.set(Text.java:194)
at org.apache.hadoop.io.Text.<init>(Text.java:86)
......
at org.apache.hadoop.hive.ql.exec.persistence.RowContainer.next(RowContainer.java:263)
\textbf{org.apache.hadoop.hive.ql.exec.persistence.Row Container.next(RowContainer.java:74)}
at org.apache.hadoop.hive.ql.exec.CommonJoinOperator.checkAndGenObject(CommonJoinOperator.java:823)
\textbf{at org.apache.hadoop.hive.ql.exec.JoinOperator.endGroup(JoinOperator.java:263)}
at org.apache.hadoop.hive.ql.exec.ExecReducer.reduce(ExecReducer.java:198)
......
at org.apache.hadoop.hive.ql.exec.persistence.RowContainer.nextBlock(RowContainer.java:397)
at org.apache.hadoop.mapred.Child.main(Child.java:170)
\end{javaerror}
\end{document}