
다음과 같은 긴 목록이 있습니다. adjustbox
선을 맞추기 위해 를 사용 하고 [float=*]
두 열에 맞추기 위해 목록 속성에 추가했습니다. 나는 사용하고있다이것두 개의 열 기반 기사인 템플릿입니다. 문제는 아래 사진에 나와 있습니다. 이런 일이 발생하는 것을 방지하는 방법은 무엇입니까?
MWE
\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의 답변을 원래 프로젝트의 코드로 바꾸면 adjustbox가 아래와 같이 렌더링되는 것처럼 보입니다.
편집 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}
편집하다: