R大师,
我正在努力在Rmarkdown中为大规模邮件合并项目设计一个信头模板。
问题是是否可以在YAML中定义标题?代码可能如下所示:
const path = require("path");
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const merge = require("webpack-merge");
const treeShakableModules = [
"@angular/animations",
"@angular/cdk",
"@angular/common",
"@angular/compiler",
"@angular/core",
"@angular/forms",
"@angular/http",
"@angular/material",
"@angular/platform-browser",
"@angular/platform-browser-dynamic",
"@angular/router",
"@asymmetrik/ngx-leaflet",
"@progress/kendo-angular-charts",
"@progress/kendo-angular-inputs",
"@progress/kendo-angular-intl",
"@progress/kendo-angular-l10n",
"@progress/kendo-drawing",
"@progress/kendo-file-saver",
"zone.js"
];
const nonTreeShakableModules = [
"@progress/kendo-theme-default/dist/all.css",
"ag-grid-angular",
"ag-grid",
"ag-grid-enterprise/dist/ag-grid-enterprise.js",
"ag-grid/dist/styles/ag-grid.css",
"ag-grid/src/styles/ag-theme-material.scss",
"bootstrap",
"bootstrap/dist/css/bootstrap.css",
"es6-promise",
"es6-shim",
"event-source-polyfill",
"exceljs/dist/exceljs.min.js",
"file-saver",
"font-awesome/css/font-awesome.css",
"hammerjs",
"jquery",
"jquery-ui-dist/jquery-ui",
"leaflet",
"leaflet/dist/leaflet.css",
"lodash",
"moment",
"ngx-bootstrap",
"tether",
"sheetjs",
"xlsx",
"./ClientApp/theme/material/js/material.js",
"./ClientApp/theme/material/js/ripples.js",
"./ClientApp/theme/material/css/bootstrap-material-design.css",
"./ClientApp/theme/material/css/ripples.css"
];
const allModules = treeShakableModules.concat(nonTreeShakableModules);
module.exports = (env) => {
const extractCSS = new ExtractTextPlugin("vendor.css");
const isDevBuild = !(env && env.prod);
//const isDevBuild = false;
const sharedConfig = {
stats: { modules: false },
resolve: {
extensions: [".js"]
},
module: {
rules: [
{ test: /\.(png|gif|jpg|jpeg|woff|woff2|eot|ttf|svg)(\?|$)/, use: "url-loader?limit=100000" },
{ test: /\.scss$/, use: ["raw-loader", "sass-loader"] }
]
},
output: {
publicPath: "dist/",
filename: "[name].js",
library: "[name]_[hash]"
},
plugins: [
new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", jquery: "jquery", "window.jQuery": "jquery", "_": "lodash" }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, "./ClientApp")), // Workaround for https://github.com/angular/angular/issues/11580
new webpack.ContextReplacementPlugin(/\@angular(\\|\/)core(\\|\/)esm5/, path.join(__dirname, "./ClientApp")),
new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, "./ClientApp")), // Workaround for https://github.com/angular/angular/issues/14898
new webpack.IgnorePlugin(/^vertx$/) // Workaround for https://github.com/stefanpenner/es6-promise/issues/100
]
};
const clientBundleConfig = merge(sharedConfig, {
entry: {
// To keep development builds fast, include all vendor dependencies in the vendor bundle.
// But for production builds, leave the tree-shakable ones out so the AOT compiler can produce a smaller bundle.
vendor: isDevBuild ? allModules : nonTreeShakableModules
},
output: { path: path.join(__dirname, "wwwroot", "dist") },
module: {
rules: [
{ test: /\.css(\?|$)/, use: extractCSS.extract({ use: isDevBuild ? "css-loader" : "css-loader?minimize" }) }
]
},
plugins: [
extractCSS,
new webpack.DllPlugin({
path: path.join(__dirname, "wwwroot", "dist", "[name]-manifest.json"),
name: "[name]_[hash]"
})
].concat(isDevBuild ? [] : [
new webpack.optimize.UglifyJsPlugin()
])
});
const serverBundleConfig = merge(sharedConfig, {
target: "node",
resolve: { mainFields: ["main"] },
entry: { vendor: allModules.concat(["aspnet-prerendering"]) },
output: {
path: path.join(__dirname, "ClientApp", "dist"),
libraryTarget: "commonjs2"
},
module: {
rules: [{ test: /\.css(\?|$)/, use: ["to-string-loader", isDevBuild ? "css-loader" : "css-loader?minimize"] }]
},
plugins: [
new webpack.DllPlugin({
path: path.join(__dirname, "ClientApp", "dist", "[name]-manifest.json"),
name: "[name]_[hash]"
})
]
});
return [clientBundleConfig, serverBundleConfig];
}
答案 0 :(得分:2)
---
title: "Prof. Jones \nDepartment \nUniversity \nState \nEmail"
output: pdf_document
editor_options:
chunk_output_type: console
header-includes:
- \usepackage{titling}
- \usepackage{graphicx}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \pretitle{\begin{flushright}\LARGE\includegraphics[width=8cm]{logo.jpg}\\[\bigskipamount]}
- \posttitle{\end{flushright}}
---
将徽标添加到{logo.jpg}
所在的位置,宽度也可能需要更改。
使用双倍空格和\n
在行头添加换行符以创建地址的解决方法。
flushright
右对齐徽标和标题。