![将文档的格式设置为列表的格式](https://linux22.com/image/337319/%E5%B0%86%E6%96%87%E6%A1%A3%E7%9A%84%E6%A0%BC%E5%BC%8F%E8%AE%BE%E7%BD%AE%E4%B8%BA%E5%88%97%E8%A1%A8%E7%9A%84%E6%A0%BC%E5%BC%8F.png)
我想将文档的文本格式设置为列表的格式。我的 tex 文档中的列表中的单词字符之间的间距较大。我希望它们具有与普通文本完全相同的格式和大小(唯一的例外是关键字)。有人可以给我一些提示吗?提前谢谢您。
\documentclass[ngerman,12pt,a4paper]{report}
\usepackage{listings}
\lstdefinelanguage{sparql} {
morekeywords={LIMIT, PREFIX, GRAPH, AS, WITH, RECURSIVE, CONSTRUCT, FROM, NAMED, SELECT, WHERE, DISTINCT, FILTER, ORDER, BY, ASC, REGEX, DSC},
sensitive=true
}
\begin{document}
\lstset{language=sparql}
\begin{lstlisting}[label=lst:rdf-rdfs-example, captionpos=b, caption=N-Triple illustration for the Figure \ref{fig:RDF-RDFS}, basicstyle=\small,float,floatplacement=H]
PREFIX ex: <http://example.com/>
RDFS:
<http://example.com/person> <rdfs:subClassOf> <http://example.com/customer> .
<http://example.com/laptop> <rdfs:subClassOf> <http://example.com/product> .
<http://example.com/hasBought> <rdfs:domain> <http://example.com/person> .
<http://example.com/hasBought> <rdfs:range> <http://example.com/product> .
RDF:
<http://example.com/persons/1> <rdf:type> <http://example.com/customer> .
<http://example.com/laptops/2> <rdf:type> <http://example.com/laptop> .
<http://example.com/persons/1> ex:hasBought <http://example.com/laptops/2> .
\end{lstlisting}
\section{RDF Frameworks}
The two major RDF frameworks that have been used for the evaluations presented in this Thesis are Jena \cite{carroll2004jena} and Sesame \cite{broekstra2002sesame} (recently known as RDF4J \footnote{\url{http://rdf4j.org}}). They are both Java frameworks for storing and querying RDF data and consist of parsers and writers for most types of RDF serializations.
\end{document}
答案1
中的间距listings
由列对齐决定(如文档第 2.10 节所述)。因此,您可以使用来columns=fullflexible
实现所需的外观:
\documentclass[ngerman,12pt,a4paper]{article}
\usepackage{listings}
\usepackage{url}
\lstdefinelanguage{sparql} {
morekeywords={LIMIT, PREFIX, GRAPH, AS, WITH, RECURSIVE, CONSTRUCT, FROM, NAMED, SELECT, WHERE, DISTINCT, FILTER, ORDER, BY, ASC, REGEX, DSC},
sensitive=true,
columns=fullflexible
}
\begin{document}
\lstset{language=sparql}
\begin{lstlisting}[label=lst:rdf-rdfs-example, captionpos=b, caption=N-Triple illustration for the Figure \ref{fig:RDF-RDFS}, basicstyle=\small,float,floatplacement=H]
PREFIX ex: <http://example.com/>
RDFS:
<http://example.com/person> <rdfs:subClassOf> <http://example.com/customer> .
<http://example.com/laptop> <rdfs:subClassOf> <http://example.com/product> .
<http://example.com/hasBought> <rdfs:domain> <http://example.com/person> .
<http://example.com/hasBought> <rdfs:range> <http://example.com/product> .
\end{lstlisting}
\section{RDF Frameworks}
The two major RDF frameworks that have been used for the evaluations presented in this Thesis are Jena \cite{carroll2004jena} and Sesame \cite{broekstra2002sesame} (recently known as RDF4J \footnote{\url{http://rdf4j.org}}). They are both Java frameworks for storing and querying RDF data and consist of parsers and writers for most types of RDF serializations.
\end{document}