English 中文(简体)
LaTeX-同一列表中的两列?
原标题:LaTeX - two columns within the same listing?

我正在努力实现以下目标,但在间距方面没有问题。

图像是我试图实现的,但没有间距问题:

目前,它只是一个带有选项卡的普通列表。

我想通过引入两列来避免选项卡。这可能吗?

当前代码:

egin{lstlisting}[caption=Elements of time in the background knowledge, label=btime]

year(Y):-                       hour(H):-
   Y in 2000..2011.                 H in 0..23.

month(M):-                  minute(M):-
   M in 1..12.                      M in 0..59.

day_of_month(D):-               seconds(S):-
    D in 1..31.                     minute(S).

date([D, M, Y]):-                   time([H,M]):-
    year(Y),                            hour(H),
    month(M),                       minute(M).
    day_of_month(D).                            

end{lstlisting}
最佳回答

类似的内容(结果看起来像THIS)?

egin{tabular}{p{7cm}p{7cm}}
 year(Y):-                           &  hour(H):-      \
  hspace{10mm}Y in 2000..2011.      &   hspace{10mm} H in 0..23.    \
& \
 month(M):-                          &  minute(M):-    \
  hspace{10mm} M in 1..12.          &   hspace{10mm} M in 0..59.    \
& \
 day\_of\_month(D):-                 &  seconds(S):-   \
  hspace{10mm} D in 1..31.          &   hspace{10mm} minute(S).     \
& \
 date([D, M, Y]):-                   &   hspace{10mm} time([H,M]):-  \
      hspace{10mm} year(Y),         &   hspace{15mm} hour(H),       \
  hspace{10mm} month(M),            &   hspace{10mm} minute(M).     \
  hspace{10mm} day\_of\_month(D).   &                 \
end{tabular}
  • Tweak the values p{Xcm} to get the column distance you want
  • Tweak the values hspace{Xmm} to get the indentation you want
    • An alternative would be to use quad or qquad, though that might not be enough for you
问题回答

暂无回答




相关问题
Effective Version Control for Slides

I have to maintain a huge set of training material in forms of slides. At a first glance, I ve noticed there s no support for version control in OpenOffice OOImpress (but I might be wrong on this). ...

Maths in LaTex table of contents

I am trying to add a table of contents for my LaTex document. The issue I am having is that this line: subsubsection{The expectation of (X^2)} Causes an error in the file that contains the ...

Using vim s `gqap sometimes indents unusually

For the life of me, I cannot figure out the cause of this: when writing in LaTeX documents, I like to keep my line width to maximum of 80 characters. As such, I will execute the vim command gqap and ...

aligning math equations in Latex

I am trying to align the following equations around the equal sign. What can I do? Thanks! I am using the AMSMath package $$mddot{x}_{1}-K(x_{2}+x_{12})+C(dot{x}_{12}+dot{x}_{2})+2Cdot{x}_{1} ...

LaTeX output does not update

I have just begun using LaTeX. I am working in Windows and am using TeXnicCenter as my editor. When I build and output, having the following code: documentclass{article} egin{document} This is a ...

How to put line break in a math

I d like to express the following sentence (source_location is also italic, it s not correctly rendered): Each entry has a list of tuple: < source_location, R/W, trip_counter, occurrence, killed ...

热门标签