我想要一个居中的页脚。我缺少什么?
% Created 2021-01-16 Sat 18:12
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{scrlttr2}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\setkomavar{firsthead}{}
\setkomavar{firstfoot}{\parbox[b]{\linewidth}{\centering\usekomavar{fromname}}}
\setkomavar{fromaddress}{foo}
\setkomavar{toaddress}{SOME place in toaddress 3b\\CODE-Townname}
\KOMAoption{fromlogo}{false}
\setkomavar{fromname}{mycenteredname}
\setkomavar{place}{foo}
\KOMAoptions{foldmarks=false}
\setkomavar{date}{\today}
\begin{document}
\begin{letter}{%
my text}
\opening{bla}
my other text
\closing{best regards}
\end{letter}
\end{document}
答案1
替换\linewidth
为\textwidth
似乎会导致水平居中的页脚:
\documentclass[11pt]{scrlttr2}
\setkomavar{firsthead}{}
\setkomavar{firstfoot}{\parbox[b]{\textwidth}{\centering\usekomavar{fromname}}}
\setkomavar{fromaddress}{foo}
\setkomavar{toaddress}{SOME place in toaddress 3b\\CODE-Townname}
\KOMAoption{fromlogo}{false}
\setkomavar{fromname}{mycenteredname}
\setkomavar{place}{foo}
\KOMAoptions{foldmarks=false}
\setkomavar{date}{\today}
\begin{document}
\begin{letter}{%
my text}
\opening{bla}
my other text
\closing{best regards}
\end{letter}
\end{document}