使用 multicol 和 minipage 控制列宽

使用 multicol 和 minipage 控制列宽

这是我的代码:

%

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage{float} %figure inside minipage
\pagestyle{empty}



%\usepackage[landscape]{geometry}
\usepackage[landscape,left=0.6in,right=0.8in,top=0.2in,bottom=.5in]{geometry}
\usepackage{url}
\usepackage{multicol}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{amsmath,amssymb}

\usepackage{listings}
\usepackage{color}

\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\lstset{frame=tb,
 backgroundcolor=\color{backcolour}, 
  language=Python,
  aboveskip=2.5mm,
  belowskip=0mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle={\small\ttfamily},
  numbers=none,
  numberstyle=\tiny\color{gray},
  keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=3
}
%\usepackage{colortbl}
%\usepackage{xcolor}
\usepackage{mathtools}
\usepackage{amsmath,amssymb}
\usepackage{enumitem}



%\advance\topmargin-.9in
%\advance\textheight1in
\advance\textwidth 1in
\advance\oddsidemargin-0.6in %plus proche de 0 on d&cale tout vers la droite
%\advance\evensidemargin-0.6in
%\parindent2pt
\parskip2pt %Espacement entre les block (minipage)
%\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}
%\colorbox[HTML]{e4e4e4}{\makebox[\textwidth-2\fboxsep][l]{texto}
\usepackage{hyperref}
\usepackage{graphicx}

\usepackage{titlesec}
% \titleformat{<command>}[<shape>]{<format>}{<label>}{<sep>}{<before-code>}[<after-code>]
\titleformat{\section}%command
{\bf \normalsize  }% format applied to label+text   \color{blue}
{{\thesection } - }% label {{\thesection } - }
{0pt}%sep
{\underline}

\titlespacing{\section}%command
{20pt}%left
{5pt plus 0pt minus 0pt}%beforesep
{2pt plus 0pt minus 0pt}%aftersep

\begin{document}

\begin{center}{\huge{\textbf{Cassandra Cheat Sheet  \\ }}}
 \end{center}



\begin{multicols*}{3}

\tikzstyle{mybox} = [draw=black, fill=white, very thick,
    rectangle, rounded corners, inner sep=10pt, inner ysep=10pt]
\tikzstyle{fancytitle} =[fill=black,   text=white, font=\bfseries]

%------------ Cell ---------------
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.25\textwidth}

\begin{lstlisting}[language=Python]
\end{lstlisting}

\end{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {Keyspaces};
\end{tikzpicture}
%------------ End ---------------


\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.25\textwidth}

\begin{lstlisting}[language=Python]
#List of databases:
DESCRIBE keyspaces; 

#Detailed list of databases
SELECT * FROM system_schema.keyspaces;

#Create database rebar suitable for development:
CREATE KEYSPACE killrvideo
WITH replication = {
  'class':'SimpleStrategy',
  'replication_factor' : 1
};

#Switch to database rebar:
USE killrvideo;
\end{lstlisting}

\end{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {Keyspaces};
\end{tikzpicture}
%------------ End ---------------

%------------ Cell ---------------
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.25\textwidth}

\begin{lstlisting}[language=Python]
#List of tables:
DESCRIBE tables;

#Describe table
DESCRIBE table videos;

#Create a table:
CREATE TABLE videos ( 
  video_id TIMEUUID, 
  added_date TIMESTAMP, 
  description TEXT, 
  title TEXT, 
  user_id UUID, 
  PRIMARY KEY (video_id) 
);


\end{lstlisting}

\end{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {Tables};
\end{tikzpicture}
%------------ End ---------------

%------------ Cell ---------------
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.25\textwidth}

\begin{lstlisting}[language=Python]
#External file of cqlsh commands
cqlsh:killrvideo> source '/home/CassandraProgs/inputfile.txt';

#
\end{lstlisting}

\end{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {External files};
\end{tikzpicture}
%------------ End ---------------

%------------ Cell ---------------
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.25\textwidth}

\begin{lstlisting}[language=Python]
#List all types
cqlsh:tutorialspoint> DESCRIBE TYPES;

#Create type
CREATE TYPE tutorialspoint.card_details(   
        num int,
        name text,
        phone set<int>,
        mail text);

#Describe
cqlsh:tutorialspoint> DESCRIBE TYPES;

\end{lstlisting}

\end{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {Type};
\end{tikzpicture}
%------------ End ---------------

%------------ Cell ---------------
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.43\textwidth}

\begin{table}[H]
\begin{tabular}{lll}
Data Type  & Constants         & Description                               \\
Bytes      &                   &                                           \\
blob       & blobs             & Represents arbitrary bytes                \\
String     &                   &                                           \\
ascii      & strings           & Represents ASCII character string         \\
text       & strings           & Represents UTF8 encoded string            \\
varchar    & strings           & Represents uTF8 encoded string            \\
inet       & strings           & Represents an IP address, IPv4 or IPv6    \\
Boolean    &                   &                                           \\
Boolean    & booleans          & Represents true or false                  \\
Numeric    &                   &                                           \\
int        & integers          & Represents 32-bit signed int              \\
varint     & integers          & Represents arbitrary-precision integer    \\
bigint     & bigint            & Represents 64-bit signed long             \\
double     & integers          & Represents 64-bit IEEE-754 floating point \\
counter    & integers          & Represents counter column                 \\
decimal    & integers, floats  & Represents variable-precision decimal     \\
float      & integers, floats  & Represents 32-bit IEEE-754 floating point \\
Identifier &                   &                                           \\
timestamp  & integers, strings & Represents a timestamp                    \\
timeuuid   & uuids             & Represents type 1 UUID                    \\
uuid       & uuids             & Represents type 1 or type 4              
\end{tabular}
\end{table}

\end{minipage}
};
\node[fancytitle, right=10pt] at (box.north west) {Data type};
\end{tikzpicture}
%------------ End ---------------








\end{multicols*}

\end{document}

以下是我的渲染: https://snag.gy/oL8hyF.jpg

如您所见,我没能减小 tikzpicture 框之间的块之间的水平间距。这可能吗?如果可以,该怎么做?

谢谢!

相关内容