
次のような長いリストがあります。adjustbox
行を合わせるために を使用し、[float=*]
リストのプロパティを追加して2列に収めました。これ2 列ベースの記事のテンプレートです。問題は下の写真に示されています。この問題を防ぐにはどうすればよいでしょうか?
ムウェ
\documentclass{comjnl}
\usepackage{lipsum}
\usepackage{listings}
\usepackage{adjustbox}
\usepackage{url}
\usepackage{amsmath}
\usepackage{cuted}
\usepackage{hyperref}
\shortauthors{jd}
\begin{document}
\lipsum[50]
\lstset{
frame = single}
\begin{lstlisting}[caption={Regular expression used to extract links within HTML code of Web pages},label=Pattern,linewidth=12cm]
"https?://(?:www\\.)?[^\\n<>\"]+(?:\"[^<]*>([^<]*))?"
\end{lstlisting}
\lipsum[50]
\begin{strip}
\centering
\centering
\adjustbox{width=\textwidth, frame}{
\begin{lstlisting}[caption={A demonstration of a hierarchical XML file used in this experiment to evaluate our framework.},label=Layers,linewidth=20cm][float=*]
<?xml version="1.0" encoding="UTF-8"?>
<crawledURLs>
<URL adr="http://www.cs.tsinghua.edu.cn/publish/csen/index.html" id="0" info="">
<URL adr="http://www.tsinghua.edu.cn title=" id="1" info=""/>
-<URL adr="http://ss.cs.tsinghua.edu.cn" id="2" info="2017 Deep Learning Summer School">
<url ADR="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic" ID="0" INFO=""/>
<url ADR="http://fontawesome.io/examples/ --" ID="1" INFO=""/>
<url ADR="http://www.cs.tsinghua.edu.cn/publish/csen/index.html" ID="2" INFO=""/>
<url ADR="http://www.tsinghua.edu.cn/publish/newthuen/newthuen_cnt/about-th/about-1.html" ID="3" INFO=""/>
</URL>
-<URL adr="http://thu-cmu.cs.tsinghua.edu.cn" id="3" info="Tsinghua-CMU Double Master Degree Progra...">
<url ADR="http://tv.tsinghua.edu.cn/folder1/folder20/2011/04/2011-04-215.html" ID="1" INFO=""/>
<url ADR="http://tv.tsinghua.edu.cn/folder1/folder20/2011/04/2011-04-215.html" ID="2" INFO="Tsinghua University Introduction"/>
<url ADR="http://www.tudou.com/programs/view/guyM0hdQNi4/?phd=99" ID="3" INFO=""/>
<url ADR="http://tv.tsinghua.edu.cn/folder1/folder20/2011/04/2011-04-215.html" ID="4" INFO="Campus Tour"/>
<url ADR="http://www.cs.tsinghua.edu.cn/" ID="5" INFO="DCST"/>
<url ADR="http://www.cmu.edu/index.shtml" ID="6" INFO="Carnegie Mellon University"/>
<url ADR="http://www.cs.tsinghua.edu.cn/" ID="7" INFO="Tsinghua CS Department"/>
<url ADR="http://www.cmu.edu/index.shtml" ID="8" INFO="CMU"/>
<url ADR="http://www.tsinghua.edu.cn/publish/th/index.html" ID="9" INFO="Tsinghua University"/>
</URL>
-<URL adr="http://ac.cs.tsinghua.edu.cn" id="4" info="Advanced Computing Master Program">
<url ADR="https://fonts.googleapis.com/icon?family=Material+Icons" ID="0" INFO=""/>
<url ADR="http://gradadmission.tsinghua.edu.cn" ID="1" INFO="Apply Now"/>
<url ADR="http://gradadmission.tsinghua.edu.cn" ID="2" INFO="Apply Now"/>
<url ADR="http://gradadmission.tsinghua.edu.cn" ID="3" INFO="Apply"/>
<url ADR="http://clem109.com" ID="4" INFO="clem109"/>
</URL>
<URL adr="http://www.csai.tsinghua.edu.cn/homepage.shtm" id="5" info="State Key Lab of Intelligence Techonoly ..."/>
<URL adr="http://media.cs.tsinghua.edu.cn/en/" id="6" info="Institute of HCI & Media Integration"/>
-<URL adr="http://soft.cs.tsinghua.edu.cn/English/index.html" id="7" info="Institute of Computer Software">
<url ADR="http://dbgroup.cs.tsinghua.edu.cn" ID="1" INFO="Data Engineering"/>
<url ADR="http://keg.cs.tsinghua.edu.cn" ID="2" INFO="Knowledge Engineering"/>
<url ADR="http://166.111.68.91" ID="3" INFO="Design Automation of Computer and VLSI Circuits"/>
<url ADR="http://vis.cs.tsinghua.edu.cn" ID="4" INFO="Visualization and Computer Graphics"/>
<url ADR="http://soft.cs.tsinghua.edu.cn/soft/" ID="5" INFO="Software Engineering and System Software"/>
<url ADR="http://dbgroup.cs.tsinghua.edu.cn" ID="6" INFO="Data Engineering"/>
<url ADR="http://keg.cs.tsinghua.edu.cn" ID="7" INFO="Knowledge Engineering"/>
<url ADR="http://166.111.68.91" ID="8" INFO="Design Automation of Computer and VLSI Circuit"/>
<url ADR="http://vis.cs.tsinghua.edu.cn" ID="9" INFO="Visualization Technology and Computer Graphics"/>
</URL>
<URL adr="http://network.cs.tsinghua.edu.cn" id="8" info="Institute of Computer Networks"/>
</URL>
</crawledURLs>
\end{lstlisting}
}
\end{strip}
\lipsum[50]
\lipsum[50]
\lipsum[50]
\lipsum[50]
\lipsum[50]
\end{document}
編集
下記の回答に基づいて、結果は次のようになります。これが、adjustbox を使用してリストをボックス内で調整できるようにする主なポイントです。
編集2
Zarko の回答を元のプロジェクトのコードに置き換えると、調整ボックスは以下のようにレンダリングされるようです。
編集3 元のプロジェクトを確認したところ、その前に別のリストがあることが問題の原因であることがわかりました。MWE を編集し、最初のリストを追加しました。新しい MWE をコンパイルすると、次のスナップショットが作成されます。
答え1
は必要ありません\adjustbox
。 はfloat=*
lstlisting 定義にある必要があります。 これは大きなフロートなので、LaTeX はそれを独自のページに押し出します。 私は、これがフローティング フロートであることを示すために floatbarrier を使用しました。
\documentclass{comjnl}
\usepackage{lipsum}
\usepackage{listings}
\usepackage{placeins}
%\usepackage{adjustbox}
\usepackage{url}
\usepackage{amsmath}
\usepackage{hyperref}
\shortauthors{jd}
\begin{document}
\lipsum
\lipsum[1-3]
\lstset{frame = single,
language=XML,
framexleftmargin=10pt,
basicstyle=\footnotesize\ttfamily,
breaklines=true}
\begin{lstlisting}[caption={A demonstration of a hierarchical XML file used in this experiment to evaluate our framework.},label=Layers,float=*]
% <?xml version="1.0" encoding="UTF-8"?>
<crawledURLs>
<URL adr="http://www.cs.tsinghua.edu.cn/publish/csen/index.html" id="0" info="">
<URL adr="http://www.tsinghua.edu.cn title=" id="1" info=""/>
-<URL adr="http://ss.cs.tsinghua.edu.cn" id="2" info="2017 Deep Learning Summer School">
<url ADR="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic" ID="0" INFO=""/>
<url ADR="http://fontawesome.io/examples/ --" ID="1" INFO=""/>
<url ADR="http://www.cs.tsinghua.edu.cn/publish/csen/index.html" ID="2" INFO=""/>
<url ADR="http://www.tsinghua.edu.cn/publish/newthuen/newthuen_cnt/about-th/about-1.html" ID="3" INFO=""/>
</URL>
-<URL adr="http://thu-cmu.cs.tsinghua.edu.cn" id="3" info="Tsinghua-CMU Double Master Degree Progra...">
<url ADR="http://tv.tsinghua.edu.cn/folder1/folder20/2011/04/2011-04-215.html" ID="1" INFO=""/>
<url ADR="http://tv.tsinghua.edu.cn/folder1/folder20/2011/04/2011-04-215.html" ID="2" INFO="Tsinghua University Introduction"/>
<url ADR="http://www.tudou.com/programs/view/guyM0hdQNi4/?phd=99" ID="3" INFO=""/>
<url ADR="http://tv.tsinghua.edu.cn/folder1/folder20/2011/04/2011-04-215.html" ID="4" INFO="Campus Tour"/>
<url ADR="http://www.cs.tsinghua.edu.cn/" ID="5" INFO="DCST"/>
<url ADR="http://www.cmu.edu/index.shtml" ID="6" INFO="Carnegie Mellon University"/>
<url ADR="http://www.cs.tsinghua.edu.cn/" ID="7" INFO="Tsinghua CS Department"/>
<url ADR="http://www.cmu.edu/index.shtml" ID="8" INFO="CMU"/>
<url ADR="http://www.tsinghua.edu.cn/publish/th/index.html" ID="9" INFO="Tsinghua University"/>
</URL>
-<URL adr="http://ac.cs.tsinghua.edu.cn" id="4" info="Advanced Computing Master Program">
<url ADR="https://fonts.googleapis.com/icon?family=Material+Icons" ID="0" INFO=""/>
<url ADR="http://gradadmission.tsinghua.edu.cn" ID="1" INFO="Apply Now"/>
<url ADR="http://gradadmission.tsinghua.edu.cn" ID="2" INFO="Apply Now"/>
<url ADR="http://gradadmission.tsinghua.edu.cn" ID="3" INFO="Apply"/>
<url ADR="http://clem109.com" ID="4" INFO="clem109"/>
</URL>
<URL adr="http://www.csai.tsinghua.edu.cn/homepage.shtm" id="5" info="State Key Lab of Intelligence Techonoly ..."/>
<URL adr="http://media.cs.tsinghua.edu.cn/en/" id="6" info="Institute of HCI & Media Integration"/>
-<URL adr="http://soft.cs.tsinghua.edu.cn/English/index.html" id="7" info="Institute of Computer Software">
<url ADR="http://dbgroup.cs.tsinghua.edu.cn" ID="1" INFO="Data Engineering"/>
<url ADR="http://keg.cs.tsinghua.edu.cn" ID="2" INFO="Knowledge Engineering"/>
<url ADR="http://166.111.68.91" ID="3" INFO="Design Automation of Computer and VLSI Circuits"/>
<url ADR="http://vis.cs.tsinghua.edu.cn" ID="4" INFO="Visualization and Computer Graphics"/>
<url ADR="http://soft.cs.tsinghua.edu.cn/soft/" ID="5" INFO="Software Engineering and System Software"/>
<url ADR="http://dbgroup.cs.tsinghua.edu.cn" ID="6" INFO="Data Engineering"/>
<url ADR="http://keg.cs.tsinghua.edu.cn" ID="7" INFO="Knowledge Engineering"/>
<url ADR="http://166.111.68.91" ID="8" INFO="Design Automation of Computer and VLSI Circuit"/>
<url ADR="http://vis.cs.tsinghua.edu.cn" ID="9" INFO="Visualization Technology and Computer Graphics"/>
</URL>
<URL adr="http://network.cs.tsinghua.edu.cn" id="8" info="Institute of Computer Networks"/>
</URL>
</crawledURLs>
\end{lstlisting}
\FloatBarrier
\lipsum[50]
\lipsum[50]
\lipsum[50]
\lipsum[50]
\lipsum[50]
\end{document}
編集: