我需要帮助完善此文档。我基本上需要三件事:
- 删除“客户”顶部的重复公司信息
- 能够自动标记今天的日期。我尝试使用“datetime”包,但每次运行脚本时它都会崩溃。
- 自动计算税额(可以在 LaTeX 中完成吗?)
PS:该示例附带一个名为“template.lco”的外部文件,在该文件中我发现以下内容:
\ProvidesFile{template.loc}[]
% firstfootvpos has to have more space to the bottom
\@setplength{firstfootvpos}{\paperheight}
\@addtoplength[-]{firstfootvpos}{30mm}
以下是实际文档的代码:
\documentclass[DIN, pagenumber=false, parskip=half,
fromalign=right,
fromphone=true,
fromfax=false,
fromrule=false]{scrlttr2}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{longtable}
\usepackage{eurosym}
\usepackage{datetime}
\LoadLetterOption{template}
\newcommand{\stdlohn}[0]{18 \% }
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{fromname}{Company}
\setkomavar{fromphone}{+49 (0) 123 / 1234 1234}
\setkomavar{fromaddress}{Address}
\setkomavar{frombank}{Bank info}
\setkomavar{subject}[]{Service description}
\setkomavar{yourmail}[Code]{BAG-EB-00001}
\setkomavar{date}[Date]{06 July 2015}
\firstfoot{
\parbox[t]{\textwidth}{\footnotesize
\begin{tabular}[t]{l@{}}
\multicolumn{1}{@{}l@{}}{\textbf{Company:}}\\
Info \\
\end{tabular}
\hfill{}
\begin{tabular}[t]{l@{}}
\multicolumn{1}{@{}l@{}}{\textbf{Bank:}}\\
Bank name\\
\end{tabular}
}}
\begin{document}
\begin{letter}{
\textbf{Client}\\
Name\\
}
\opening{\ }
\vspace{-1.9cm}
\begin{longtable}{p{7.8cm}p{1.0cm}p{1cm}p{2.7cm}p{2.5cm}}
\hline
Description & Amount & U & Price & Total\\
\hline
\textbf{Service}\\
Service & 1 & H & USD 60.00 {} & USD 60.00{}\\ \\
\hline\hline
\end{longtable}
\begin{longtable}{p{5.5cm}p{3cm}p{3cm}}
\hline A & \stdlohn Tax & B\\
\hline
USD 6,000.00{} & USD 6,000.00 & \textbf{USD 6,000.00}{}\\
\hline
\hline
\end{longtable}
\end{letter}
\end{document}
答案1
编辑:我将代码改为 MWE。
使用这两个命令,您可以仅打印税费或两个值的总和。您可以将它们放在您希望它们出现的任何位置。
\documentclass{standalone}
\usepackage{pgf,pgfmath}
\pgfkeys{/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=2,
set thousands separator={.},
set decimal separator={,}
}
\newcommand{\taxes}[2]{%
\pgfmathparse{#1*#2/100}%
\pgfmathprintnumber{\pgfmathresult}%
}
\newcommand{\addtaxes}[2]{%
\pgfmathparse{#1+#1*#2/100}%
\pgfmathprintnumber{\pgfmathresult}%
}
\def\taxval{18}
\def\money{4.5}
\begin{document}
\begin{tabular}{cr}
Worktime & \pgfmathprintnumber{\money} \\
Taxes (\taxval\,\%)& \taxes{\money}{\taxval} \\
Sum & \addtaxes{\money}{\taxval}
\end{tabular}
\end{document}
答案2
我只回答前两个问题。
如果你不想在“客户端”顶部显示后端地址,请使用类选项
backaddress=false
要设置以西班牙语自动设置今天的邮票,请删除\usepackage{datetime}
并删除\setkomavar{date}[Date]{06 July 2015}
。
代码:
\begin{filecontents*}{template.lco}
\ProvidesFile{template.lco}[]
% firstfootvpos has to have more space to the bottom
\@setplength{firstfootvpos}{\paperheight}
\@addtoplength[-]{firstfootvpos}{30mm}
\end{filecontents*}
\documentclass[DIN, pagenumber=false, parskip=half,
fromalign=right,
fromphone=true,
fromfax=false,
fromrule=false,
backaddress=false,
% numericaldate
]{scrlttr2}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{longtable}
\usepackage{eurosym}
%\usepackage{datetime}% <- removed
\LoadLetterOption{template}
\newcommand{\stdlohn}[0]{18 \% }
\renewcommand*{\raggedsignature}{\raggedright}
\setkomavar{fromname}{Company}
\setkomavar{fromphone}{+49 (0) 123 / 1234 1234}
\setkomavar{fromaddress}{Address}
\setkomavar{frombank}{Bank info}
\setkomavar{subject}[]{Service description}
\setkomavar{yourmail}[Code]{BAG-EB-00001}
%\setkomavar{date}[Date]{06 July 2015}% <-removed
\setkomavar{firstfoot}{% <- changed
\parbox[t]{\textwidth}{\footnotesize
\begin{tabular}[t]{l@{}}
\multicolumn{1}{@{}l@{}}{\textbf{Company:}}\\
Info \\
\end{tabular}
\hfill{}
\begin{tabular}[t]{l@{}}
\multicolumn{1}{@{}l@{}}{\textbf{Bank:}}\\
Bank name\\
\end{tabular}
}}
\begin{document}
\begin{letter}{
\textbf{Client}\\
Name\\
}
\opening{\ }
\vspace{-1.9cm}
\begin{longtable}{p{7.8cm}p{1.0cm}p{1cm}p{2.7cm}p{2.5cm}}
\hline
Description & Amount & U & Price & Total\\
\hline
\textbf{Service}\\
Service & 1 & H & USD 60.00 {} & USD 60.00{}\\ \\
\hline\hline
\end{longtable}
\begin{longtable}{p{5.5cm}p{3cm}p{3cm}}
\hline A & \stdlohn Tax & B\\
\hline
USD 6,000.00{} & USD 6,000.00 & \textbf{USD 6,000.00}{}\\
\hline
\hline
\end{longtable}
\end{letter}
\end{document}
请注意,我已将其更改\firstfoot{...}
为\setkomavar{firstfoot}{...}
。这是最新的语法。
如果你的文档的语言是,english
你可以将 babel 选项更改为english
。然后使用
\usepackage[english]{isodate}\cleanlookdateon
而是通过加载datetime
和删除\setkomavar{date}[Date]{06 July 2015}
以相同的格式自动设置今天的邮票。