LaTeX 文件和文件夹符号

LaTeX 文件和文件夹符号

是否有文件和文件夹/目录符号乳胶

就像是:

文件和文件夹符号

答案1

您可以使用 pdflatex 包含任何图形文件。只需使用 XeLaTeX 来准备它们即可。

例如,将以下文件保存为FolderOpen.tex

\documentclass{standalone}
\usepackage{fontawesome}
\begin{document}
\fontsize{24}{0}\selectfont
\faFolderOpen
\end{document}

使用 XeLaTeX 编译它并使用 PDF 文件,如下所示:

\documentclass{article}
\usepackage{graphicx}

\newcommand{\FolderOpen}[1][.8\ht\strutbox]{%
  \includegraphics[height=#1]{FolderOpen}%
}

\begin{document}
\begin{itemize}
\item[\FolderOpen] This is an open folder
\item This isn't
\end{itemize}

Also a big open folder: \FolderOpen[1cm].
\end{document}

在此处输入图片描述

答案2

Font Awesome 包含文件和文件夹的符号。但它需要 XeTeX 或 LuaTeX,例如:

\documentclass{article}
\usepackage{fontspec}
\usepackage{fontawesome}
\begin{document}
  File: \faFile\ \faFileAlt\par
  Folder: \faFolderOpen\ \faFolderClose\ \faFolderOpenAlt\ \faFolderCloseAlt
\end{document}

结果

不使用 LuaTeX/XeTeX

符号可以放在独立文件中。然后 LuaTeX/XeTeX 会生成一个 PDF 文件,并将其作为图形包含在内,例如:

% FileAlt.tex
% lualatex/xelatex
\documentclass{standalone}
\usepackage{fontawesome}

\begin{document}%
\faFileAlt
\end{document}

FileAlt.pdf然后生成文件:

lualatex FileAlt

并且结果FileAlt.pdf可以包含在pdflatex中:

\documentclass{article}
\usepackage{graphics}
\begin{document}
  \includegraphics{FileAlt}
\end{document}

还可以生成 EPS 文件,例如:

pdftoeps -eps FileAlt.pdf

但是,边界框不太精确,可以改进。如果将包含的文件再次转换为 PDF,我也遇到了一些问题,因此我添加了第三步,使用 purifyeps 将 EPS 转换为更简单的 PostScript,而无需字体依赖性:

pdftops -eps FileAlt.pdf temp1.eps
epstool --copy --bbox --output temp2.eps temp1.eps
purifyeps temp2.eps FileAlt.eps

然后它可以包含在 latex/dvips 中:

\includegraphics[hiresbb]{FileAlt}

答案3

使用tikz。找到一个.svg文件,在 inkscape 中打开它,然后tikz使用 导出为代码inkscape2tikz

\documentclass[tikz,border=5pt]{standalone}
\begin{document}

\definecolor{cc4a000}{RGB}{196,160,0}
\definecolor{ceeeeec}{RGB}{238,238,236}
\definecolor{c204a87}{RGB}{32,74,135}
\definecolor{cedd400}{RGB}{237,212,0}


\begin{tikzpicture}[y=0.80pt, x=0.8pt,yscale=-1, inner sep=0pt, outer sep=0pt]
\begin{scope}[shift={(-20.42857,-28.63543)}]
    \path[draw=black,fill=cc4a000,line join=round,line cap=round,miter
      limit=4.00,dash phase=15.792pt,line width=1.600pt,rounded corners=0.0000cm]
      (21.4286,186.6479) rectangle (708.5715,643.7908);
    \begin{scope}[cm={{0.58178,-0.81335,0.81335,0.58178,(165.90533,-14.59901)}}]
      \path[cm={{-0.00202,1.0,-1.0,-0.00202,(0.0,0.0)}},draw=black,fill=ceeeeec,line
        join=round,line cap=round,miter limit=4.00,dash phase=15.792pt,line
        width=1.600pt,rounded corners=0.0000cm] (99.7727,-17.2073) rectangle
        (641.2012,342.8532);
      \begin{scope}[cm={{1.0,0.0,0.0,0.52631,(-1.66834,57.53025)}}]
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,156.1510) -- (-5.8354,156.1510);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,121.9502) -- (-5.8354,121.9502);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,190.3519) -- (-5.8354,190.3519);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,224.5528) -- (-5.8354,224.5528);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,258.7537) -- (-5.8354,258.7537);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,327.1554) -- (-5.8354,327.1554);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,361.3563) -- (-5.8354,361.3563);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,395.5572) -- (-5.8354,395.5572);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,429.7581) -- (-5.8354,429.7581);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,463.9590) -- (-5.8354,463.9590);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,498.1598) -- (-5.8354,498.1598);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,532.3607) -- (-5.8354,532.3607);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,566.5616) -- (-5.8354,566.5616);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,600.7625) -- (-5.8354,600.7625);
        \path[draw=c204a87,line join=miter,line cap=butt,line width=1.103pt]
          (-317.9725,292.9545) -- (-5.8354,292.9545);
      \end{scope}
    \end{scope}
    \path[draw=black,fill=cedd400,line join=round,line cap=round,miter
      limit=4.00,dash phase=15.792pt,line width=1.600pt] (178.1531,232.3622) --
      (795.0523,232.3622) .. controls (814.5098,232.3622) and (825.9769,246.5090) ..
      (820.7633,264.0816) -- (717.0939,613.5000) .. controls (711.8803,631.0725) and
      (692.0187,645.2193) .. (672.5613,645.2193) -- (55.6620,645.2193) .. controls
      (36.2045,645.2193) and (24.7374,631.0725) .. (29.9510,613.5000) --
      (133.6204,264.0816) .. controls (138.8340,246.5090) and (158.6956,232.3622) ..
      (178.1530,232.3622) -- cycle;
\end{scope}

\end{tikzpicture}


\end{document}

在此处输入图片描述

对文件图标执行相同操作或简单绘制它:

\documentclass[tikz,border=5pt]{standalone}
\begin{document}
\begin{tikzpicture}
  \draw (0,0) -- (0,1.2) -- (0.7,1.2) -- (0.7,0.8) -- (1,0.8) -- (1,0) -- cycle;
  \draw (0.7,1.2) -- (1,0.8);
  \foreach \y in {0.2,0.4,0.6}{
     \draw (0.2,\y) -- (0.8,\y);
     \draw (0.2,0.8) -- (0.6,0.8);
     \draw (0.2,1) -- (0.6,1);
  }
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案4

  1. 维基百科并下载Folder_open_alt_font_awesome.svg。有同一目录中有更多图标
  2. convert Folder_open_alt_font_awesome.svg FolderOpen.pdf
  3. 使用 PDF

正如 Egreg 解释的那样:

\documentclass{article}
\usepackage{graphicx}

\newcommand{\FolderOpen}[1][.8\ht\strutbox]{%
  \includegraphics[height=#1]{FolderOpen}%
}

\begin{document}
\begin{itemize}
\item[\FolderOpen] This is an open folder
\item This isn't
\end{itemize}

Also a big open folder: \FolderOpen[1cm].
\end{document}

相关内容