Markdown不缩进第一段

时间:2016-04-24 20:37:34

标签: markdown rstudio

我现在正在撰写一份报告,而报告的每一部分下面的第一段并没有缩进,而其他段落则是缩进的。

我不确定这是否重要,但这是正在使用的软件包

#include <fstream>
#include <iostream>
#include <map>
#include <string>
#include <utility>

/**
 * Parses std::string _buffer line input, assigning correct data
 * to code, name and price params.
 */
void parse_input(unsigned int& _prod_code, std::string& _prod_name, 
    double& _prod_price, const std::string& _buffer) {
    size_t count1 = 0;
    // find first tab character
    while (_buffer.at(count1) != '\t') {
        ++count1;
    }
    // set product code to substring of _buffer from beginning
    // to first tab, converted to integral type
    _prod_code = atoi(_buffer.substr(0, count1).c_str());
    size_t count2 = count1 + 1;
    // find second tab character
    while (_buffer.at(count2) != '\t') {
        ++count2;
    }
    // set product code to substring of _buffer from end of first tab
    // to next tab occurrence
    _prod_name = _buffer.substr(count1 + 1, count2);
    size_t count3 = count2 + 1;
    while (_buffer.at(count3) != '\t') {
        ++count3;
    }
    // set product price to last entry of tabbed columns of input
    _prod_price = atof(_buffer.substr(count2 + 1, count3).c_str());
}

int main(void) {
    std::map<unsigned int, std::pair<std::string, double>> product_map;

    const char* pfile_path = "product_data.txt";
    std::ifstream product_file(pfile_path);

    std::string buffer = "";
    // get file contents line by line
    while (getline(product_file, buffer)) {
        unsigned int product_code;
        std::string product_name;
        double product_price;
        // call parse_input with product data vars and buffer
        parse_input(product_code, produce_name, product_price, buffer);
        // insert data to product_map
        product_map.insert(std::make_pair(product_code,
                           std::make_pair(product_name, product_price)));
    }
}

1 个答案:

答案 0 :(得分:1)

这是默认的乳胶行为,因为它也是排版传统通常对英语论文所要求的。您可以通过以下方式将其关闭:

  • 指定应关闭的语言(请参阅this answer on tex.SE)。例如:

    ---
    lang: french
    ---
    
  • 使用包indentfirst

    强制缩进第一段
    ---
    header-includes:
       - \usepackage{indentfirst}
    ---