带图片的书籍列表

带图片的书籍列表

我想从电子图书馆购买一些书籍,所以我想为什么我不通过在乳胶文档中制作书籍清单来向他们发送我的请求,如下所示:

在此处输入图片描述

我的想法 :

\documentclass{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{array}% http://ctan.org/pkg/array
\begin{document}

\begin{table}[h!]
  \centering
  \begin{tabular}{ | c | m{5cm} | m{5cm} | }
    \hline
    Title of books  \\ \hline
    \begin{minipage}{.3\textwidth}
      \includegraphics[width=\linewidth, height=60mm]{book1.jpg}
    \end{minipage}
    &     &      \\ \hline
          &     &      \\ \hline
  \end{tabular}
  \caption{list of books}\label{L}
\end{table}

\end{document}

答案1

可能是这样的(特殊的桌子设计留给 OP——这取决于个人品味)

在此处输入图片描述

在此处输入图片描述

我定义了一个简单的键值接口,将相关条目作为值和排版。由于 a 中设置了 allgroup并且预设为空,所以默认值都是空。

我还添加了一个.lob要生成的文件,即list of books包含在其中\listofbooks\tableofcontents暂时伪造的文件。

\documentclass[10pt]{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{array}% http://ctan.org/pkg/array

\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage{xparse}
\usepackage{multirow}

\usepackage{xkeyval}


\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}

\makeatletter
\define@key{lob}{editeur}{%
  \def\kv@lob@editeur{#1}%
}

\define@key{lob}{broche}{%
  \def\kv@lob@broche{#1}%
}


\define@key{lob}{isbndix}{%
  \def\kv@lob@isbndix{#1}%
}

\define@key{lob}{isbntreize}{%
  \def\kv@lob@isbntreize{#1}%
}

\define@key{lob}{collection}{%
  \def\kv@lob@collection{#1}%
}

\define@key{lob}{langue}{%
  \def\kv@lob@langue{#1}%
}
\define@key{lob}{dimensions}{%
  \def\kv@lob@dimensions{#1}%
}


\NewDocumentCommand{\listofbooks}{O{List of Books}}{%
  \begingroup
  \def\contentsname{#1}
  \let\latex@@starttoc\@starttoc
  \def\@starttoc##1{\latex@@starttoc{lob}}
  \tableofcontents%
  \endgroup
}



\newcounter{ebook}

\NewDocumentCommand{\ebookentry}{sO{}+mm}{%
  \noindent%
  \begingroup
  \bfseries%
  \medskip
  \setkeys{lob}{broche={},langue={}, dimensions={},collection={},isbntreize={}, isbndix={}, editeur={},#2}%
  \refstepcounter{ebook}%
  \addcontentsline{lob}{section}{\protect\numberline{\theebook}#3}%
  \begin{tabular}{|m{2cm}m{5cm}|C{5cm}|}
      \hline
      \multicolumn{3}{|C{\dimexpr12cm+6\tabcolsep}|}{#3} \tabularnewline
      \hline
      Number: & \theebook  &  \tabularnewline
      \cline{1-2} 
      Broché: & \kv@lob@broche  &  \tabularnewline
      \cline{1-2} 
      Éditeur: & \kv@lob@editeur & \multirow{6}*{#4} \tabularnewline 
      \cline{1-2} 
      Collection: & \kv@lob@collection  &  \tabularnewline
      \cline{1-2} 
      Langue:  &\kv@lob@langue  &  \tabularnewline
      \cline{1-2} 
      ISBN 10: & \kv@lob@isbndix  &  \tabularnewline
      \cline{1-2} 
      ISBN 13:  &\kv@lob@isbntreize  &  \tabularnewline
      \cline{1-2}
      Dimensions:  &\kv@lob@dimensions  &  \tabularnewline
      \hline
    \end{tabular}%
    \medskip
  \endgroup
}

\makeatother

\begin{document}

\listofbooks

\clearpage

\ebookentry[editeur={J.R.R. Tolkien}, dimensions={Very thick!}]{Lord Of the Rings}{\includegraphics[scale=0.2]{ente1}}
\ebookentry[editeur={William Shakespeare}, langue={Anglais}]{Hamlet}{\includegraphics[scale=0.2]{ente1}}
\end{document}

简易版使用键的“自动定义”:

\documentclass[10pt]{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{array}% http://ctan.org/pkg/array

\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage{xparse}
\usepackage{multirow}

\usepackage{xkeyval}


\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}

\makeatletter

\newcommand{\autodefinekey}[1]{%
  \define@key{lob}{#1}{%
    \expandafter\def\csname kv@lob@#1\endcsname{##1}%
  }
}


\autodefinekey{editeur}
\autodefinekey{broche}
\autodefinekey{isbntreize}
\autodefinekey{isbndix}
\autodefinekey{langue}
\autodefinekey{author}
\autodefinekey{dimensions}
\autodefinekey{collection}


\NewDocumentCommand{\listofbooks}{O{List of Books}}{%
  \begingroup
  \def\contentsname{#1}
  \let\latex@@starttoc\@starttoc
  \def\@starttoc##1{\latex@@starttoc{lob}}
  \tableofcontents%
  \endgroup
}



\newcounter{ebook}

\NewDocumentCommand{\ebookentry}{sO{}+mm}{%
  \noindent%
  \begingroup
  \bfseries%
  \medskip
  \renewcommand{\arraystretch}{1.2}%
  \setkeys{lob}{author={},broche={},langue={}, dimensions={},collection={},isbntreize={}, isbndix={}, editeur={},#2}%
  \refstepcounter{ebook}%
  \IfBooleanF{#1}{%
    \addcontentsline{lob}{section}{\protect\numberline{\theebook}#3}%
  }   
  \begin{tabular}{|m{2cm}m{5cm}|C{5cm}|}
      \hline
      \multicolumn{3}{|c|}{} \tabularnewline
      \multicolumn{3}{|C{\dimexpr12cm+6\tabcolsep}|}{#3} \tabularnewline
      \multicolumn{3}{|c|}{} \tabularnewline
      \hline
      Number: & \theebook  &  \tabularnewline
      \cline{1-2} 
      Broché: & \kv@lob@broche  &  \tabularnewline
      \cline{1-2} 
      Author: & \kv@lob@author  & \tabularnewline
      \cline{1-2} 
      Éditeur: & \kv@lob@editeur & \multirow{6}*{#4} \tabularnewline 
      \cline{1-2} 
      Collection: & \kv@lob@collection  &  \tabularnewline
      \cline{1-2} 
      Langue:  &\kv@lob@langue  &  \tabularnewline
      \cline{1-2} 
      ISBN 10: & \kv@lob@isbndix  &  \tabularnewline
      \cline{1-2} 
      ISBN 13:  &\kv@lob@isbntreize  &  \tabularnewline
      \cline{1-2}
      Dimensions:  &\kv@lob@dimensions  &  \tabularnewline
      \hline
    \end{tabular}%
    \medskip
  \endgroup
}

\makeatother

\begin{document}

\listofbooks

\clearpage

\ebookentry[editeur={J.R.R. Tolkien}, dimensions={Very thick!}]{Lord Of the Rings}{\includegraphics[scale=0.2]{ente1}}
\ebookentry[author={William Shakespeare}, langue={Anglais}]{Hamlet}{\includegraphics[scale=0.2]{ente1}}
\ebookentry[author={Monty Python}, langue={Anglais}]{Collected Words}{}
\ebookentry[author={City of New York}, langue={Anglais}]{Phone dictionary of New York}{}
\end{document}

相关内容