使用 tabularx 的带滑块的侧列表格

使用 tabularx 的带滑块的侧列表格

我正在尝试使用 LaTex 制作简历。我想用我所知道的不同口语来显示我的自信程度。显示使用表格格式。出于某种原因,我的 tabularx 失败并报错。

Package array Error:  Illegal pream-token (t): `c' used.

下面是我为制作展示而建立的 MWE。

\documentclass[landscape]{article}
\usepackage[margin=1cm,twoside]{geometry}
\geometry{a5paper, reset, left=2cm}
\usepackage{tikz,tabularx,amssymb, incgraph}
\usepackage{pgfplots}
\usepackage{tablefootnote}

%\usetikzlibrary{calc}
%\usepackage{}
\usetikzlibrary{shapes.geometric, calc, shadows.blur, shapes, shapes.multipart}
\def\CircleSLIDER#1#2{% 1: length, 2: position of the mark (0 to 1)
    \tikz[baseline=-0.1cm]{
        \coordinate (start) at (0,-0.1cm);
        \coordinate (end) at (#1,0.1cm);
        \coordinate (mark) at ($(start|-0,0)!#2!(end|-0,0)$);
        \fill[rounded corners=0.1cm, draw=gray, bottom color=lightgray, top color=black, middle color=lightgray] (start) rectangle (end);
        \shade[draw=darkgray, rounded corners=0.2mm, ball color=blue!20!cyan] (mark) circle(.15) ;
    }
}

\def\SquareSLIDER#1#2{% 1: length, 2: position of the mark (0 to 1)
    \tikz[baseline=-0.1cm]{
        \coordinate (start) at (0,-0.1cm);
        \coordinate (end) at (#1,0.1cm);
        \coordinate (mark) at ($(start|-0,0)!#2!(end|-0,0)$);
        \fill[rounded corners=0.1cm, draw=gray, bottom color=lightgray, top color=black, middle color=lightgray] (start) rectangle (end);
        \shade[draw=darkgray, rounded corners=0.2mm, ball color=blue!20!cyan] (mark) +(-.15,-.15) rectangle +(.15, .15) ;
    }
}
\def\TriangleSLIDER#1#2{% 1: length, 2: position of the mark (0 to 1)
    \tikz[baseline=-0.1cm]{
        \coordinate (start) at (0,-0.1cm);
        \coordinate (end) at (#1,0.1cm);
        \coordinate (mark) at ($(start|-0,0)!#2!(end|-0,0)$);
        \fill[rounded corners=0.1cm, draw=gray, bottom color=lightgray, top color=black, middle color=lightgray] (start) rectangle (end);
        \shade[draw=darkgray, rounded corners=0.2mm, ball color=blue!20!cyan] (mark) ++(-.15,-.15) -- ++(.15,-.15) -- ++(.15,.15) -- ++(0,.3) -- ++(-.3,0) -- cycle ;
    }
}


\newcommand\score[2]{%
    \pgfmathsetmacro\pgfxa{#1 + 1}%
    \tikzstyle{scorestars}=[star, star points=5, star point ratio=2.25, draw, inner sep=0.15em, anchor=outer point 3]%
    \begin{tikzpicture}[baseline]
        \foreach \i in {1, ..., #2} {
            \pgfmathparse{\i<=#1 ? "yellow" : "gray"}
            \edef\starcolor{\pgfmathresult}
            \draw (\i*1em, 0) node[name=star\i, scorestars, fill=\starcolor]  {};
        }
        \pgfmathparse{#1>int(#1) ? int(#1+1) : 0}
        \let\partstar=\pgfmathresult
        \ifnum\partstar>0
        \pgfmathsetmacro\starpart{#1-(int(#1)}
        \path [clip] ($(star\partstar.outer point 3)!(star\partstar.outer point 2)!(star\partstar.outer point 4)$) rectangle 
        ($(star\partstar.outer point 2 |- star\partstar.outer point 1)!\starpart!(star\partstar.outer point 1 -| star\partstar.outer point 5)$);
        \fill (\partstar*1em, 0) node[scorestars, fill=yellow]  {};
        \fi
    \end{tikzpicture}%
}
%%\def\IosSevenSlider{#1#2}{
%\def\IosSevenSlider{2}{
%   \tikz[baseline=-0.1cm]{
%       \coordinate (start) at (0,0) {0\% };
%       \coordinate (end) at (#1,0) {100\%};
%       \coordinate (mark) at ($(start)!#2!(end)$);
%       \useasboundingbox (start|- 0,-.25) rectangle (end|- 0, .25);
%       \draw[line width=0.4mm, line cap=round, blue!50!cyan] 
%       (start) -- (mark) edge[red] (end);
%       \node[fill=white, draw=lightgreen, very thin,
%       blur shadow={shadow xshift=0pt, shadow opacity=20, shadow yshift=-0.9mm,
%           shadow blur steps=6, shadow blur radius=0.3mm},
%       circle, minimum size=0.25cm, inner sep=0pt] at (mark);
%   }
%}

\begin{document}
%\CircleSLIDER{2.5cm}{0.4}
%\SquareSLIDER{2.5cm}{0.7}

\TriangleSLIDER{5cm}{0.1}\newline
\TriangleSLIDER{5cm}{0.2}\newline
\TriangleSLIDER{5cm}{0.3}\newline
\TriangleSLIDER{5cm}{0.4}\newline
\TriangleSLIDER{5cm}{0.5}\newline
\TriangleSLIDER{5cm}{1}\newline
    \begin{table*}
        {
            \footnote{\score{0}{5} 0\%          
            \small\score{3}{5} 50\%-60\%
            \Huge{\score{5}{5} 100\%}}}]
%       \title{LANGUAGE Fluency:}
    \begin{tabularx}{123.6mm}{title="Language\nolinebreak Fluency"}
    {|c(5.29mm)|c(5.59mm)|p(5.29mm)|X|}% original {X|X|X} 
        \textbf{Language} & \textbf{Fluency} & \textbf{Remark}\\ \newline
        {English}:&\TriangleSLIDER{1cm}{1}&Well Conversant \newline
        {Hindi}:&\TriangleSLIDER{1cm}{1}&Well Conversant \newline
        {Malayalam}:&\TriangleSLIDER{1cm}{0.6}& Conversant for $ >40+$ years \newline
        {Kannada}:&\TriangleSLIDER{1cm}{.5}& Conversant for  $\lessapprox years  \\ \newline
        {Tamil}:&\TriangleSLIDER{1cm}{.4}& Conversant for \lessapprox 10+years
    \end{tabularx}  **<<-- {{font color | red| ERROR LINE ** >Package array Error: Illegal pream-token (t): `c' used.}}
    \\ \newline
\end{table*}
\tcbuselibrary{listings}{title=Alex}
        \begin{tcblisting}{colback=red!50,colframe=red!75!black}
        This is a \LaTeX\ example which displays the text as source code
        and in compiled form.
        \end{tcblisting}
    \begin{tikzpicture}
        \draw[node font=\itshape] (1,0) -- +(1,1) node[above] {italic};
        \tikz \node[fill=yellow!80!black,align=center]
        {This is a\\[-2pt] demonstration text for\\[1ex] alignments.};
    \end{tikzpicture}
%   The following lines of code are worthless.  Keeping it here for future reference.
%   \begin{tikzpicture}[x=1.5cm]
%       \pgfkeys{/pgf/number format/.cd,fixed,precision=2}
%       
%       \foreach \i in {0,1,...,5}{
%           \pgfmathsetmacro{\num}{int(10*\i)}  
%           \draw (\i,0) node[below=1mm]{$\num$}--+(90:2mm);
%       }
%       % Total 44 participants
%       \foreach \j/\jtext/\jnum in {1/A/32,2/B/40,3/C/42}{
%           \draw (0,\j) node[left=5mm]{\jtext}--+(180:2mm);
%           \pgfmathsetmacro{\jpercent}{\jnum/44*100};       
%           \draw[blue!50,line width=3mm] (0,\j)--+(0:\jnum/10) 
%           node[right,blue]{$\jnum \;(\pgfmathprintnumber{\jpercent} \%)$};
%       }
%       
%       \draw (0,3.5)--(0,0)--(5,0);
%       \path
%       (current bounding box.north) node[above]{My title}
%       (current bounding box.south) node[below=2mm]{Number of Participants};
%   \end{tikzpicture}
    
%   \setlength{\fboxsep}{0pt}
%   Some Errors seen in this macro call.  Worked once.
%    TO DO:
%       DeBUG the macro on a latter day.
%   \fbox{\IosSevenSlider{5cm}{0.7}}
\end{document}

我已尝试将表格柱状宽度设为静态,但无济于事。

有 TexPerts 能指出我对表格列大小的假设哪里出了问题吗?谢谢,Alex

答案1

错误

! Package array Error:  Illegal pream-token (t): `c' used.

来自t虚假论点的第一个字母

{title="Language\nolinebreak Fluency"}

如果你删除它,你会得到

! Package array Error:  Illegal pream-token ((): `c' used.

( 不确定c(5.59mm)你的意图,但我把它改成了wc{5.59mm}两次,p(5.29mm)然后p{5.29mm}

由此得出

! Extra alignment tab has been changed to \cr.

正如你似乎已经使用,\newline所以\\所有条目都在同一行

! Missing $ inserted.
<inserted text> 
                $
l.100     \end{tabularx}
                        
? 

失踪$$\lessapprox

然后你得到

! Undefined control sequence.
l.103 \tcbuselibrary

来自未定义的命令,但与此 tabularx 问题无关

相似地

! LaTeX Error: Environment tcblisting undefined.

然后它没有错误,但所有内容都在三个狭窄的列中,没有使用X第四列,所以我删除了|p{5.29mm}其他列并使之更宽

在此处输入图片描述

\documentclass[landscape]{article}
\usepackage[margin=1cm,twoside]{geometry}
\geometry{a5paper, reset, left=2cm}
\usepackage{tikz,tabularx,amssymb, incgraph}
\usepackage{pgfplots}
\usepackage{tablefootnote}

%\usetikzlibrary{calc}
%\usepackage{}
\usetikzlibrary{shapes.geometric, calc, shadows.blur, shapes, shapes.multipart}
\def\CircleSLIDER#1#2{% 1: length, 2: position of the mark (0 to 1)
    \tikz[baseline=-0.1cm]{
        \coordinate (start) at (0,-0.1cm);
        \coordinate (end) at (#1,0.1cm);
        \coordinate (mark) at ($(start|-0,0)!#2!(end|-0,0)$);
        \fill[rounded corners=0.1cm, draw=gray, bottom color=lightgray, top color=black, middle color=lightgray] (start) rectangle (end);
        \shade[draw=darkgray, rounded corners=0.2mm, ball color=blue!20!cyan] (mark) circle(.15) ;
    }
}

\def\SquareSLIDER#1#2{% 1: length, 2: position of the mark (0 to 1)
    \tikz[baseline=-0.1cm]{
        \coordinate (start) at (0,-0.1cm);
        \coordinate (end) at (#1,0.1cm);
        \coordinate (mark) at ($(start|-0,0)!#2!(end|-0,0)$);
        \fill[rounded corners=0.1cm, draw=gray, bottom color=lightgray, top color=black, middle color=lightgray] (start) rectangle (end);
        \shade[draw=darkgray, rounded corners=0.2mm, ball color=blue!20!cyan] (mark) +(-.15,-.15) rectangle +(.15, .15) ;
    }
}
\def\TriangleSLIDER#1#2{% 1: length, 2: position of the mark (0 to 1)
    \tikz[baseline=-0.1cm]{
        \coordinate (start) at (0,-0.1cm);
        \coordinate (end) at (#1,0.1cm);
        \coordinate (mark) at ($(start|-0,0)!#2!(end|-0,0)$);
        \fill[rounded corners=0.1cm, draw=gray, bottom color=lightgray, top color=black, middle color=lightgray] (start) rectangle (end);
        \shade[draw=darkgray, rounded corners=0.2mm, ball color=blue!20!cyan] (mark) ++(-.15,-.15) -- ++(.15,-.15) -- ++(.15,.15) -- ++(0,.3) -- ++(-.3,0) -- cycle ;
    }
}


\newcommand\score[2]{%
    \pgfmathsetmacro\pgfxa{#1 + 1}%
    \tikzstyle{scorestars}=[star, star points=5, star point ratio=2.25, draw, inner sep=0.15em, anchor=outer point 3]%
    \begin{tikzpicture}[baseline]
        \foreach \i in {1, ..., #2} {
            \pgfmathparse{\i<=#1 ? "yellow" : "gray"}
            \edef\starcolor{\pgfmathresult}
            \draw (\i*1em, 0) node[name=star\i, scorestars, fill=\starcolor]  {};
        }
        \pgfmathparse{#1>int(#1) ? int(#1+1) : 0}
        \let\partstar=\pgfmathresult
        \ifnum\partstar>0
        \pgfmathsetmacro\starpart{#1-(int(#1)}
        \path [clip] ($(star\partstar.outer point 3)!(star\partstar.outer point 2)!(star\partstar.outer point 4)$) rectangle 
        ($(star\partstar.outer point 2 |- star\partstar.outer point 1)!\starpart!(star\partstar.outer point 1 -| star\partstar.outer point 5)$);
        \fill (\partstar*1em, 0) node[scorestars, fill=yellow]  {};
        \fi
    \end{tikzpicture}%
}
%%\def\IosSevenSlider{#1#2}{
%\def\IosSevenSlider{2}{
%   \tikz[baseline=-0.1cm]{
%       \coordinate (start) at (0,0) {0\% };
%       \coordinate (end) at (#1,0) {100\%};
%       \coordinate (mark) at ($(start)!#2!(end)$);
%       \useasboundingbox (start|- 0,-.25) rectangle (end|- 0, .25);
%       \draw[line width=0.4mm, line cap=round, blue!50!cyan] 
%       (start) -- (mark) edge[red] (end);
%       \node[fill=white, draw=lightgreen, very thin,
%       blur shadow={shadow xshift=0pt, shadow opacity=20, shadow yshift=-0.9mm,
%           shadow blur steps=6, shadow blur radius=0.3mm},
%       circle, minimum size=0.25cm, inner sep=0pt] at (mark);
%   }
%}

\begin{document}
%\CircleSLIDER{2.5cm}{0.4}
%\SquareSLIDER{2.5cm}{0.7}

\TriangleSLIDER{5cm}{0.1}\newline
\TriangleSLIDER{5cm}{0.2}\newline
\TriangleSLIDER{5cm}{0.3}\newline
\TriangleSLIDER{5cm}{0.4}\newline
\TriangleSLIDER{5cm}{0.5}\newline
\TriangleSLIDER{5cm}{1}\newline
    \begin{table*}
        {
            \footnote{\score{0}{5} 0\%          
            \small\score{3}{5} 50\%-60\%
            \Huge{\score{5}{5} 100\%}}}]
%       \title{LANGUAGE Fluency:}
    \begin{tabularx}{350mm}
    {|wc{15mm}|wc{15mm}|X|}% original {X|X|X} 
        \textbf{Language} & \textbf{Fluency} & \textbf{Remark}\\ 
        {English}:&\TriangleSLIDER{1cm}{1}&Well Conversant \\
        {Hindi}:&\TriangleSLIDER{1cm}{1}&Well Conversant \\
        {Malayalam}:&\TriangleSLIDER{1cm}{0.6}& Conversant for $ >40+$ years \\
        {Kannada}:&\TriangleSLIDER{1cm}{.5}& Conversant for  $\lessapprox$ years  \\
        {Tamil}:&\TriangleSLIDER{1cm}{.4}& Conversant for $\lessapprox$ 10+years
    \end{tabularx}

\end{table*}
%\tcbuselibrary{listings}{title=Alex}
%        \begin{tcblisting}{colback=red!50,colframe=red!75!black}
%        This is a \LaTeX\ example which displays the text as source code
%        and in compiled form.
%        \end{tcblisting}
    \begin{tikzpicture}
        \draw[node font=\itshape] (1,0) -- +(1,1) node[above] {italic};
        \tikz \node[fill=yellow!80!black,align=center]
        {This is a\\[-2pt] demonstration text for\\[1ex] alignments.};
    \end{tikzpicture}
%   The following lines of code are worthless.  Keeping it here for future reference.
%   \begin{tikzpicture}[x=1.5cm]
%       \pgfkeys{/pgf/number format/.cd,fixed,precision=2}
%       
%       \foreach \i in {0,1,...,5}{
%           \pgfmathsetmacro{\num}{int(10*\i)}  
%           \draw (\i,0) node[below=1mm]{$\num$}--+(90:2mm);
%       }
%       % Total 44 participants
%       \foreach \j/\jtext/\jnum in {1/A/32,2/B/40,3/C/42}{
%           \draw (0,\j) node[left=5mm]{\jtext}--+(180:2mm);
%           \pgfmathsetmacro{\jpercent}{\jnum/44*100};       
%           \draw[blue!50,line width=3mm] (0,\j)--+(0:\jnum/10) 
%           node[right,blue]{$\jnum \;(\pgfmathprintnumber{\jpercent} \%)$};
%       }
%       
%       \draw (0,3.5)--(0,0)--(5,0);
%       \path
%       (current bounding box.north) node[above]{My title}
%       (current bounding box.south) node[below=2mm]{Number of Participants};
%   \end{tikzpicture}
    
%   \setlength{\fboxsep}{0pt}
%   Some Errors seen in this macro call.  Worked once.
%    TO DO:
%       DeBUG the macro on a latter day.
%   \fbox{\IosSevenSlider{5cm}{0.7}}
\end{document}

相关内容